[antlr-interest] a question about comment

yhhf_dy yhhf_dy at yahoo.com
Wed Oct 9 13:45:24 PDT 2002


Hi everybody,

I'm new to Antlr. I want to develop a parser for a language. In the 
language it uses REM and ' as keywords for comment. I wrote the 
following grammar to deal with comments. it obviously that "rem " is 
nondeterminism upon IDENT. Would you please help me erase the 
nondeterminism error. thanks a lot.

COMMENT
  : "rem "
  | '\'' (~('\n'|'\r'))* ('\n'|'\r'('\n')?)
    {$setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP); newline();}
  ;		

IDENT
 options {testLiterals=true;}
 :('a'..'z'|'_') ('a'..'z'|'_'|'0'..'9')*	
 ;

WS_ 
 :(' '
   | '\t'
   ){ _ttype = ANTLR_USE_NAMESPACE(antlr)Token.SKIP; }
 ;


 

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



More information about the antlr-interest mailing list