[antlr-interest] Bug in buildTokenTypeASTClassMap generation(antlr
2.7.2)
Ives Landrieu
ives.landrieu at pandora.be
Thu Jul 17 05:12:16 PDT 2003
Ric Klaren wrote:
>Hi,
>
>On Wed, Jul 16, 2003 at 04:43:15PM -0000, ilandrieu wrote:
>
>
>>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);
>> ....
>>
>>
>
>Could reproduce it. Could you try changing in JavaCodegenerator.java in the
>method getTokenASTNodeMap the line:
>
> println("tokenTypeToASTClassMap.put(new Integer("+s+"), "+
> ts.getASTNodeType()+".class);");
>
>To:
>
>
> println("tokenTypeToASTClassMap.put(new Integer("+ts.getTokenType()+"), "+
> ts.getASTNodeType()+".class);");
>
>I think that will fix the problem. I'll put up a snapshot with the fix
>shortly at http://wwwhome.cs.utwente.nl/~klaren/antlr/
>
>
That snapshot fixes the problem for me.
>
>
>>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?
>>
>>
>
>Now it's a known issue ;)
>
>
It WAS a known issue ;-)
>Thanks for the report!
>
>
Thanks for the quick reply!
>Cheers,
>
>
Schol ;-),
Ives
>Ric
>
>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list