Use the API in CommonTree to get the token(s) from tree nodes, then use the API in CommonToken to ask for line and position of individual tokens. Use the individual tokens where necessary.
Jim From: BeRniTo [mailto:[email protected]] Sent: Saturday, November 20, 2010 6:34 PM To: Jim Idle Cc: [email protected] Subject: Re: [antlr-interest] Knowing line and position in tree parser I'm doing type checking within a Tree Grammar and want to include line and position (if possible) of where the error was. For example: int i = "a"; When analysing the expression part the type won't match so I want to emit an error saying "type missmatch in X:Y" where X would be the line number and Y the position where the error happened. I don't know where to start searching in the API. I think an example would be much better. Thanks! 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.
