v2.4.0
Full Changelog: v2.1.0...v2.4.0
syntax added - token with lookahead
P / term
P / [term1 term_start-term_last]
P / [^term1 term_start-term_last]
PatternP
followed by one of given terminal set. Lookaheads are not consumed.
syntax added - parenthesis group patterns
E : A p=( P1 P2 P3 ) B { A + p.0 + p.1 + p.2 + B } ;
Captures subsequence P1 P2 P3
as single token.
- If none of the patterns hold value, the group itself will not hold any value.
- If only one of the patterns holds value, the group will hold the value of the very pattern. And the variable name will be same as the pattern.
(i.e. IfP1
holds value, and others don't, then(P1 P2 P3)
will hold the value ofP1
, and can be accessed via nameP1
) - If there are multiple patterns holding value, the group will hold
Tuple
of the values. There is no default variable name for the group, you must define the variable name explicitly by=
operator.
NoRuleType: ... ;
I(i32): ... ;
// I will be chosen
A: (NoRuleType I NoRuleType) {
println!( "Value of I: {:?}", I ); // can access by 'I'
I
};
// ( i32, i32 )
B: i2=( I NoRuleType I ) {
println!( "Value of I: {:?}", i2 ); // must explicitly define the variable name
};