Well you could, but I think there are some obvious problems: 1) What line number do you use? 2) If the tree node spans two files, which file do you use? 3) How many other things do we need to set up?
So, the standard thing to do is create your own error message output that decides whether to use the token that comes before in the token stream, the token that comes afterwards, the first child token that is not itself virtual, and if so, then do you mean depth first or breadth first? Etc etc? That is why I am telling you that I can't do anything generic. So, if you need error messages in the tree parser, then you have to code it up yourself. Are you sure that you need virtual tokens in the tree if you need to know where they are in relation to the real tokens? To be honest, if you are getting errors on the tree nodes, then just make the debugger break in the message handler so that you have the stack trace, and then for production mode, you just want an "Internal compiler error - please report ...." Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Petteri Räty > Sent: Wednesday, May 25, 2011 1:08 PM > To: [email protected] > Subject: Re: [antlr-interest] Why stream name can't be printed out when > error occurs(ANTLR C)? > > On 05/25/2011 11:02 PM, Jim Idle wrote: > > So, it is a bug in the tree grammar and you have not implemented an > > error message handler that can help you in development. I cannot > > create an error handler that is all things to all men - hence the > > supplied default just tries to use lots of ways to gather > information, > > so you can decide what is needed for your specific case. > > > > Jim > > > > But is there something preventing virtual tokens from associating to > input so that the default just works? If not I could look at creating a > patch to make it work. > > Regards, > Petteri > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your- > email-address 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.
