At 07:32 20/09/2008, jack zhang wrote:
>Thanks. Now the warnings are cleared. The only issue I had is
>that for the following invalid inputs, it won't report error.
>Here is the grammar.
>1) AND
>2) OR
>3) AND a
>4) OR a
[...]
>expr: orexpression*;
Your top level rule does not require anything at all to be matched
("*" is zero-or-more, and if the input isn't a valid orexpression
then it'll simply match nothing at all and succeed).
If you want to require at least one orexpression to be present,
change the * to a +. If you want to additionally ensure that the
entire input is consumed (or produce an error if not), add EOF to
the end of the rule. For example:
expr : orexpression+ EOF;
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/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
-~----------~----~----~----~------~----~------~--~---