[antlr-interest] Bug? "new (new" code generated.

Steve Bennett stevagewp at gmail.com
Thu Jan 31 23:58:36 PST 2008


I split a working grammar into a lexer and parser. Using Antlrworks
1.1.7, I now get this error:

[18:36:53] C:\antlr\__Test__.java:9: <identifier> expected
[18:36:53]  lex = new (new ANTLRFileStream("C:\\antlr\\__Test___input.txt"));
[18:36:53]            ^
[18:36:53] C:\antlr\__Test__.java:9: '(' or '[' expected
[18:36:53]  lex = new (new ANTLRFileStream("C:\\antlr\\__Test___input.txt"));
[18:36:53]                                                                  ^
[18:36:53] 2 errors

Here's the complete code being generated. Am I doing something wrong?

import java.io.*;
import org.antlr.runtime.*;
import org.antlr.runtime.debug.DebugEventSocketProxy;


public class __Test__ {

    public static void main(String args[]) throws Exception {
 lex = new (new ANTLRFileStream("C:\\antlr\\__Test___input.txt"));
        CommonTokenStream tokens = new CommonTokenStream(lex);

        mediawiki2Parser g = new mediawiki2Parser(tokens, 49153);
        try {
            g.start();
        } catch (RecognitionException e) {
            e.printStackTrace();
        }
    }
}

Steve


More information about the antlr-interest mailing list