At 14:08 9/08/2009, Graham Wideman wrote: >The basic issue is what the arguments to -> ^(NEWTOKEN[args] are >expected to be (ie: their types) and where such args can be >obtained from.
The arguments must match one of the available implementations of the tree adaptor's create method (with one extra parameter for the token type) -- unless you're using heterogeneous trees, as Tomasz was. Then it's the constructor of the node type that matters. Assuming you're using the standard nodes then you'll have these possibilities: no args: creates a blank token with the token type as its text [text]: creates a blank token with the specified text [token]: copies the specified token but changes its type [token, text]: copies the specified token but changes its type and text >It wasn't clear to me if some form of this (eg: >$parserRule.something) should work... ie: should it be possible >to get a token from a parser rule? Some further light on this >would be helpful. You can use $rule.start and $rule.stop to get the start and end tokens of the range matched by a rule, or you can specify your own return values for a rule to return other specific tokens. In both cases you need to be careful if the rule can successfully match no tokens at all (or not the one you're asking for). 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 -~----------~----~----~----~------~----~------~--~---
