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

Jean Bovet antlr-list at arizona-software.ch
Sun Feb 3 22:46:19 PST 2008


ANTLRWorks does not support yet the split grammar. I will add full  
support in version 1.2 with the help of two mechanisms: ANTLRWorks  
will first try to find the lexer by using the name provided in  
tokenVocab. If this name does not exist, ANTLRWorks will ask the user  
to provide the name/file of the lexer grammar.

Regards,

Jean

On Jan 31, 2008, at 11:58 PM, Steve Bennett wrote:

> 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