[antlr-interest] includeFile example correct file name when error occurs
christiancormier
cormier at u-picardie.fr
Fri Nov 1 10:13:33 PST 2002
I am not sure to be right, but it seems that to obtain the right
included file name when error occurs, needs to add some code like
this!
Right?
With antlr-2.7.2a4_10-27-2002.jar
in file Main.java
...
mainFileName = args[0]; // main file
...
in file Lexer.g
public void uponEOF() throws TokenStreamException,
CharStreamException {
if ( Main.selector.getCurrentStream() != Main.mainLexer ) {
Main.selector.pop(); // return to old lexer/stream
Main.parser.setFilename(Main.mainFileName); // added
...
INCLUDE
: "@include" (WS)? f:STRING
{
// create lexer to handle include
String name = f.getText();
Main.fileName = name; // added
...
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list