[antlr-interest] [antlr2.7.7] Forcing string literals into literals hash table.

Buras, Mariusz Mariusz_Buras at mentor.com
Tue May 15 06:21:26 PDT 2007


Hi!

 

I need your advise on my lexer. I'll go first with example:

 

class MyLexer extends Lexer;

options {

      testLiterals=false;     

      k=4; 

}

 

ENDMODULE:        "endmodule";

 

/* hundreds of keywords here... */

 

IDENTIFIER 

      options {testLiterals=true;} 

      :     ( ('a'..'z')|('A'..'Z')|'_' )? ( ( ('a'..'z')|('A'..'Z')|'_'
)? )+

      ;

 

And of course I got nondeterminism between ENDMODULE (and other literals
defined in that meaner) and C_IDENTIFIER.

Now my question is if it's possible to force antlr (2.7.7) to put
ENDMODULE literal into its the hash table ? 

I know that I should put my keywords quoted directly  in my grammar but
I'd favor this way (as an old Lex prick ;) )

 

Greetings,

M.Buras

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070515/ef05867b/attachment.html 


More information about the antlr-interest mailing list