Implementing static path
This commit is contained in:
@@ -45,6 +45,23 @@ impl TryFrom<pest::iterators::Pair<'_, Rule>> for TypeExpr {
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<pest::iterators::Pair<'_, Rule>> for StaticPath {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(pair: pest::iterators::Pair<'_, Rule>) -> Result<Self, Self::Error> {
|
||||
if pair.as_str() == "void" {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
Ok(match pair.as_rule() {
|
||||
Rule::static_path => {
|
||||
StaticPath(pair.into_inner().map(|i| i.as_str().to_string()).collect())
|
||||
}
|
||||
_ => unimplemented!("{pair:#?}"),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl From<pest::iterators::Pair<'_, Rule>> for FieldList {
|
||||
fn from(pair: pest::iterators::Pair<Rule>) -> Self {
|
||||
let params = pair
|
||||
|
||||
Reference in New Issue
Block a user