[antlr-interest] ANTLR 3.1: Abbreviated keywords & imported lexer

Kay Röpke kroepke at classdump.org
Mon Aug 18 16:22:44 PDT 2008


On Aug 18, 2008, at 11:38 PM, zosrothko wrote:

> I am trying to implement the implicit abbreviated keywords according  
> to
> the Wiki FAQ on the Simple example along with the importing grammar
> feature, but whatever configuration I am testing, ANTLR answer is
> Simple.g:18:8: no lexer rule corresponding to token: VAR
> Can someone explain me how should be declare the keyword VAR using the
> implicit strategy(i.e, without putting VAR : 'VAR' in the lexer)??


Put the tokens {} section into the lexer and add the option  
tokenVocab=<YourLexerNameHere>; to the options of the parser.
It will then see the token type for VAR (and you don't want to put  
VAR:'VAR'; into the lexer because that will give you warnings or weird  
results anyway).

cheers,
-k
-- 
Kay Röpke
http://classdump.org/








More information about the antlr-interest mailing list