[antlr-interest] Bug in buildTokenTypeASTClassMap generation(antlr 2.7.2)
    ilandrieu 
    ives.landrieu at pandora.be
       
    Wed Jul 16 09:43:15 PDT 2003
    
    
  
Hi,     
     
I'm not a user of antlr, but I am using it to compile the Java Data Objects  
reference implementation. Their grammar file contains rules like:     
     
    IMPORT = "import"         <AST=com.sun.jdori.common.query.tree.Node>;      
     
(the quotes around import are important, I could not throw them out). This leads 
to the generation of the following code in antlr 2.7.2 for the method  
buildTokenTypeASTClassMap in the parser class :     
     
	protected void buildTokenTypeASTClassMap() {     
		tokenTypeToASTClassMap = new Hashtable();     
		tokenTypeToASTClassMap.put(new Integer("import"),    
com.sun.jdori.common.query.tree.Node.class);     
        ....     
     
This code causes a NumberFormatException("import" cannot be parsed to an 
integer value) when called (as happens in the  constructor of the parser class).     
The correct code seems to be:     
  
	tokenTypeToASTClassMap.put(new Integer(IMPORT),     
                                        com.sun.jdori.common.query.tree.Node.class);     
     
I solved my problem, but I wanted to know whether this is a known issue with  
antlr 2.7.2 (or should I file it somewhere?), or is it a problem in the JDO grammar  
file?     
     
Cheers,     
Ives     
     
     
 
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
    
    
More information about the antlr-interest
mailing list