Added expr? syntax
This commit is contained in:
@@ -71,6 +71,7 @@ pub enum Postfix {
|
||||
StructCall(Vec<(Identifier, Expression)>),
|
||||
Index(Expression),
|
||||
As(TypeExpr),
|
||||
Try,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
|
||||
@@ -500,6 +500,10 @@ as_px = {
|
||||
"as" ~ type_expr
|
||||
}
|
||||
|
||||
try_px = {
|
||||
"?"
|
||||
}
|
||||
|
||||
postfix = {
|
||||
field_px
|
||||
| call_px
|
||||
@@ -507,6 +511,7 @@ postfix = {
|
||||
| struct_px
|
||||
| index_px
|
||||
| as_px
|
||||
| try_px
|
||||
}
|
||||
|
||||
// ------------------------------------------------------
|
||||
|
||||
@@ -183,6 +183,8 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for Postfix {
|
||||
ast_expr!(Postfix::As(inner.next().unwrap().try_into()))
|
||||
}
|
||||
|
||||
Rule::try_px => Ok(Postfix::Try),
|
||||
|
||||
_ => AstError::bug_unimplemented(pair),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user