Added expr? syntax

This commit is contained in:
2026-05-17 06:08:53 +02:00
parent e270ec727e
commit 5fa3e77b8f
4 changed files with 10 additions and 0 deletions
+1
View File
@@ -71,6 +71,7 @@ pub enum Postfix {
StructCall(Vec<(Identifier, Expression)>),
Index(Expression),
As(TypeExpr),
Try,
}
#[derive(Debug, Clone, Serialize)]
+5
View File
@@ -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
}
// ------------------------------------------------------
+2
View File
@@ -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),
}
}