[antlr-interest] tokenVocab and certain rules cause NullPointerException in org.antlr.Tool

Erik Kratochvil discontinuum at gmail.com
Mon Feb 4 05:43:29 PST 2008


Hi, thanks for interesting tips. I did as you instructed and split the
grammar into two grammars.

lexer grammar Flex;
S:';';
W:' ';

and

parser grammar Fpar;
options { tokenVocab = Basic; tokenVocab = Flex; }
r: (~S)+;

If the file Basic.tokens contained just

Gosub=10

the exception was not thrown. However, if I tried to change it to

S=10

the exception was back like Arnold Schwarzenegger's Terminator.

I'm resigning to forcing ANTLR to assign certain token types to
selected literals and I'm going to hardwire them via my own
testLiterals() or setType().


Erik Kratochvíl


More information about the antlr-interest mailing list