You might need to introduce the Tree adaptor if you're using the custom type of tree nodes. It's described here: http://www.antlr.org/wiki/display/ANTLR3/Tree+construction
On Thu, Jan 27, 2011 at 8:57 AM, Bart Kiers <[email protected]> wrote: > On Wed, Jan 26, 2011 at 10:40 PM, Ching <[email protected]> wrote: > > > Can anyone tell me why I got this exception? My output is AST. Thanks. > > > > > Err, that error is pretty self-explanatory: you're trying to cast > a org.antlr.runtime.CommonToken to a org.antlr.runtime.tree.Tree, which is > illegal. As you can see from ANTLR's class hierarchy: > http://www.antlr.org/api/Java/hierarchy.html > the two can't be cast (either CommonToken->Tree or Tree->CommonToken). > > Perhaps you don't understand where this happens in your grammar? In that > case, please show your grammar as well. > > Regards, > > Bart. > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > -- Piotr Kaleta List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
