[antlr-interest] help required on defining lexer rules

vamsikp0406 vamsikp0406 at yahoo.co.in
Fri Jul 2 04:04:30 PDT 2004


Hi,

I'm using antlr for parsing param=value pairs entered by the user in 
command line interface.

I'm facing one problem. I'm writing a portion of the code here for 
clarity.

There are three rules defined in lexer as follows:

NAME : 'n' ('a' ('m' ('e')?)?)?;
MARKS : 'm' ('a' ('r' ('k' ('s')?)?)?)?;

ALPHANUM
    : ('=') => '=' (WS!)? (~(' ' | '\n' | '\t'))+
    | (~(' ' | '\n' | '\t'))+
    ;

name and marks are parameter names those can be extended to minimum 
characters (like n=vamsi m=90) & ALPHANUM rule is for values.

So when I give the input as nm=vamsi, then antlr is recognizing MARKS 
token is followed by NAME token. But I should print to the user 
as "nm parameter is unknown".

Can anyone help me doing this.

Thanks & Regards,
Vamsi.





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list