[antlr-interest] Two lexers, one parser

Paul J. Lucas dude at darkfigure.org
Fri Nov 8 12:16:36 PST 2002


I have two lexers with some common tokens.  I put the lexer into a CommonTokenTypes.txt file.  In lexer1 I do:

	importVocab = Common;
	exportVocab = Lexer1;

and similarly for lexer2.  In the parser I do:

	importVocab = Lexer1;
	importVocab = Lexer2;
	exportVocab = Parser;

However, if I look at the tokens in the *TokenTypes.java files for Lexer1 and Parser, the integer constants for tokens are different.  This would explain why the parser complains about an unexpected token: the numbers don't match so it thinks it's getting the wrong token.

What's the proper way to do this to make sure the integer constants match?

- Paul


 

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



More information about the antlr-interest mailing list