I had
grammar RatingGrammar {
rule TOP { ^ <statement>+ $ };
rule statement { <id> '=' <endvalue>
| {
if ($/.CURSOR.pos < $/.orig.chars) {
self.panic($/, "Declaration syntax
incorrect.")
}
}
};
This generates an error for a correct input because it fails <statement>
at the end of input.
After experimenting, I found the following workaround ( note the & <id> )
grammar RatingGrammar {
rule TOP { ^ <statement>+ $ };
rule statement { <id> '=' <endvalue>
| {
if ($/.CURSOR.pos < $/.orig.chars) {
self.panic($/, "Declaration syntax
incorrect.")
}
}
& <id>
};
This works, but it does seem counter-intuitive.