Hi,
I have a tricky problem that i cant seem to get right.
I have a static semantics rule which says " ';' is optional if
preceding statement ends with '}' or the statement is last in list"
Basically meaning either have LA(-1) == '}' or LA(1) == '}' or we
should expect a ';'.
This rule is used in many places throughout the grammar so a generic
approach would be best.
I would like this case to produce good error messages since missing
';' is quite common.
Can i use a "standard" rule and mark it somehow to not consume a token
if it shouldnt (like the below example)?
end:
: ';'
| '}' { doNotConsume() }
| ( LA(-1) == '}' ) { doNotConsume() } ;
BR Gustaf
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.