Thanks. That explains it.
--- On Fri, 9/19/08, Gavin Lambert <[EMAIL PROTECTED]> wrote:
From: Gavin Lambert <[EMAIL PROTECTED]>
Subject: Re: [antlr-interest] Alternative(s) 2 were disabled for that input
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Date: Friday, September 19, 2008, 11:03 PM
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;
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address