[antlr-interest] Using own ASTLabelType and quantification
Olaf Keijsers
egrimm at dds.nl
Tue Jan 12 08:06:24 PST 2010
Greetings,
I am trying to make a treewalker for my grammar in order to check if it
contains nondeterminism. I would like to be able to set some properties for
every node I encounter, so I figured it would be a good idea to use my own
ASTLabelType.
I have set "ASTLabelType=GrooveTree" in my options, and my grammar uses this
labeltype now, but I get the following exception when trying to use the
checker:
java.lang.ClassCastException: org.antlr.runtime.tree.CommonTree cannot be
cast to groove.control.parse.GrooveTree
at
groove.control.parse.GCLDeterminismChecker.program(GCLDeterminismChecker.java:139)
This line contains:
root_0 = (GrooveTree)adaptor.nil();
and is part of the program() method. Somehow I think this is a beginner's
error, but I cannot find the solution. I have tried to work around it by
using the default ASTLabelType and keeping a Map<CommonTree,Boolean> to keep
track of the property I would like, but this seems cumbersome. Could anyone
point me in a good direction?
Thanks!
Olaf Keijsers
More information about the antlr-interest
mailing list