[antlr-interest] Bad Token-type to AST-Class map in 2.7.2 Java; broken release
Terence Parr
parrt at cs.usfca.edu
Sat Dec 20 17:06:33 PST 2003
Hi Thomas,
Looks ok to me at the moment:
protected void buildTokenTypeASTClassMap() {
tokenTypeToASTClassMap = new Hashtable();
tokenTypeToASTClassMap.put(new Integer(4),
persist.qtree.Node.class);
tokenTypeToASTClassMap.put(new Integer(5),
persist.qtree.ThisExpr.class)
;
};
for this simple grammar:
class P extends Parser;
options {
buildAST = true;
}
tokens {
IMPORT_ON_DEMAND <AST=persist.qtree.Node>;
FOO = "foo" <AST=persist.qtree.ThisExpr>;
}
a : FOO ;
Can you tell me more about your switches or whatever?
Thanks!
Ter
On Saturday, December 6, 2003, at 02:34 AM, random_uv wrote:
> Hi, just diagnosed 2.7.2 as problematic and gone back to 2.7.0.
>
> Problem is tokens declared with string literal:
>
> IMPORT_ON_DEMAND <AST=persist.qtree.Node>;
> THIS = "this" <AST=persist.qtree.ThisExpr>;
> ASCENDING = "ascending" <AST=persist.qtree.AscendingOrderingExpr>;
>
> Generates a broken TokenType to AST ClassMap.
>
> tokenTypeToASTClassMap.put(new Integer(IMPORT_ON_DEMAND),
> persist.qtree.Node.class);
> tokenTypeToASTClassMap.put(new Integer("this"),
> persist.qtree.ThisExpr.class);
> tokenTypeToASTClassMap.put(new Integer("ascending"),
> persist.qtree.AscendingOrderingExpr.class);
>
> Note that tokens without string (literals?) assigned are OK as they
> are mapping by integer constants; but tokens with strings are
> generated broken with the strings as map IDs.
>
> Proceeding with 2.7.0 for now. Anyone else seen this problem?
>
>
> Regards,
> Thomas
>
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com pure link sharing
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list