[antlr-interest] Recognizing java import statements

Edward O'Flynn esof1 at student.cs.ucc.ie
Thu Dec 1 03:51:01 PST 2005


Hi all

I am using the java grammar provided with the antlr 2.7.5 release, when 
i try and parse a java file
thats contains an import statement, its just recognizes the import 
statement, and not the rest of the program, no error is thrown and the 
resulting AST tree contains just the import rule
i.e. import java.util.*;

this is the rule
// Import statement: import followed by a package or class name
importDefinition
    options {defaultErrorHandler = true;}
    :    i:"import"^ {#i.setType(IMPORT);} identifierStar SEMI!
    ;

Is this a know bug?

thanks
ed.


More information about the antlr-interest mailing list