Adding increment
This commit is contained in:
@@ -7,6 +7,8 @@ pub mod event;
|
|||||||
void main() {
|
void main() {
|
||||||
var mut app_instance = new app::Application("mist-app");
|
var mut app_instance = new app::Application("mist-app");
|
||||||
|
|
||||||
|
i++;
|
||||||
|
|
||||||
// greeting::register(&mut app_instance);
|
// greeting::register(&mut app_instance);
|
||||||
// statistics::register(&mut app_instance);
|
// statistics::register(&mut app_instance);
|
||||||
|
|
||||||
|
|||||||
@@ -497,8 +497,13 @@ as_px = {
|
|||||||
range_end_inc_px = { "..=" }
|
range_end_inc_px = { "..=" }
|
||||||
range_end_exc_px = { ".." }
|
range_end_exc_px = { ".." }
|
||||||
|
|
||||||
|
increment_px = { "++" }
|
||||||
|
decrement_px = { "++" }
|
||||||
|
|
||||||
postfix = {
|
postfix = {
|
||||||
field_px
|
field_px
|
||||||
|
| increment_px
|
||||||
|
| decrement_px
|
||||||
| call_px
|
| call_px
|
||||||
| macro_call_px
|
| macro_call_px
|
||||||
| struct_px
|
| struct_px
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for Expression {
|
|||||||
let mut primary_pair = None;
|
let mut primary_pair = None;
|
||||||
let mut postfix_pairs = Vec::new();
|
let mut postfix_pairs = Vec::new();
|
||||||
|
|
||||||
// Sort out flat layout components
|
|
||||||
for p in inner {
|
for p in inner {
|
||||||
match p.as_rule() {
|
match p.as_rule() {
|
||||||
Rule::prefix => prefix_pairs.push(p),
|
Rule::prefix => prefix_pairs.push(p),
|
||||||
@@ -95,7 +94,6 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for Expression {
|
|||||||
);
|
);
|
||||||
let postfixes = collect_recovered::<Postfix, Postfix>(postfix_pairs.into_iter());
|
let postfixes = collect_recovered::<Postfix, Postfix>(postfix_pairs.into_iter());
|
||||||
|
|
||||||
// Employs your exact original logic using the GetLength trait
|
|
||||||
if postfixes.len() > 0 || prefixes.len() > 0 {
|
if postfixes.len() > 0 || prefixes.len() > 0 {
|
||||||
ast_expr!(Expression::Fix {
|
ast_expr!(Expression::Fix {
|
||||||
initial: exp.map(Box::new),
|
initial: exp.map(Box::new),
|
||||||
@@ -183,6 +181,13 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for Postfix {
|
|||||||
|
|
||||||
Rule::macro_call_px => Ok(Postfix::MacroCall(inner.as_str().to_string())),
|
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),
|
_ => AstError::bug_unimplemented(pair),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user