diff --git a/mist-test/src/main.mist b/mist-test/src/main.mist index 853e686..6a71985 100644 --- a/mist-test/src/main.mist +++ b/mist-test/src/main.mist @@ -7,6 +7,8 @@ pub mod event; void main() { var mut app_instance = new app::Application("mist-app"); + i++; + // greeting::register(&mut app_instance); // statistics::register(&mut app_instance); diff --git a/parser/src/grammar.pest b/parser/src/grammar.pest index b955b95..3c45c37 100644 --- a/parser/src/grammar.pest +++ b/parser/src/grammar.pest @@ -497,8 +497,13 @@ as_px = { range_end_inc_px = { "..=" } range_end_exc_px = { ".." } +increment_px = { "++" } +decrement_px = { "++" } + postfix = { field_px + | increment_px + | decrement_px | call_px | macro_call_px | struct_px diff --git a/parser/src/parser/common/expr.rs b/parser/src/parser/common/expr.rs index 8abf3f6..10fb2b2 100644 --- a/parser/src/parser/common/expr.rs +++ b/parser/src/parser/common/expr.rs @@ -79,7 +79,6 @@ impl<'a> TryFrom> for Expression { let mut primary_pair = None; let mut postfix_pairs = Vec::new(); - // Sort out flat layout components for p in inner { match p.as_rule() { Rule::prefix => prefix_pairs.push(p), @@ -95,7 +94,6 @@ impl<'a> TryFrom> for Expression { ); let postfixes = collect_recovered::(postfix_pairs.into_iter()); - // Employs your exact original logic using the GetLength trait if postfixes.len() > 0 || prefixes.len() > 0 { ast_expr!(Expression::Fix { initial: exp.map(Box::new), @@ -183,6 +181,13 @@ impl<'a> TryFrom> for Postfix { Rule::macro_call_px => Ok(Postfix::MacroCall(inner.as_str().to_string())), + Rule::as_px => { + ast_expr!(Postfix::As(inner.next().unwrap().try_into())) + } + + Rule::range_end_inc_px => Ok(Postfix::RangeInclusive), + Rule::range_end_exc_px => Ok(Postfix::RangeExclusive), + _ => AstError::bug_unimplemented(pair), } }