Try:
cmd_validate
: cmd CMD_OPTION EOF
;
ANTLR will report errors if you have extra input.
Dave
On Jan 26, 2009, at 8:03 PM, Meena Vinod wrote:
> Hello,
> This pet project of mine requires that I can validate a command. The
> command is of the form <command_name><command options>
>
> My lexer consists of all the command names and options:
>
> Ex:
>
> CMD_CD : 'cd';
> CMD_SHOW: 'show';
> CMD_RESET: 'reset';
> CMD_SET: 'set';
> CMD_OPTION: '-all' | '-help';
> TSEP: ' ' { SKIP(); };
>
> The parser is defined as:
> cmd_validate: (cmd)(CMD_OPTION);
>
> cmd: CMD_CD | CMD_SHOW | CMD_RESET | CMD_SET;
>
> For all valid inputs, the cmd_validate behaves properly.
>
> On the ANTLRWorks, when I give a junk input say 'zee zee', the
> ANTLRWorks does not generate any proper output and does not evn
> throw an exception.
> Also, the C code generated hangs when given this input.
>
> Can someone help me out on this?
>
> Many thanks,
> Swift.
>
>
>
> 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
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address