[antlr-interest] Recognizing java import statements

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


Hi all

I am using the java grammar file that is contained in the antlr 2.7.5 examples
However when i try and parse a java file that contains an import statement
i.e. import java.util.*;

it parses the import statement but not the rest of the file, and the resulting 
AST tree contains just the import rule
No error is thrown, the following is the import 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 known bug?

thanks
ed.




More information about the antlr-interest mailing list