[antlr-interest] Referencing Template(s) in a grammar.
Jim Idle
jimi at temporal-wave.com
Tue Nov 24 10:59:35 PST 2009
Can you not just return the template up the rule chain, or the thing that the xmlWhere template needs to reference down the rule chain, or just put that thing itself in the scope and set it when you create the template?
However you just need a StringTemplate field in a scope and set it to whatever. $st refers to the current rules ST.
Jim
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Craig Main
> Sent: Tuesday, November 24, 2009 6:49 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Referencing Template(s) in a grammar.
>
>
> How do I put a 'tempate' into a scope so that I can expand it again.
>
> If I have:
>
>
> xpath: decl+=declaration p+=path
> ->template(decl=decl, p=p) .. do stuff.
>
> ... (Lots of productions)
>
> comp: ^('comparison' (op= ... // etc
> ->xmlWhere(declarations=decl)
>
> I need the 'decl' template from the top production in xmlWhere which is
> a
> template
> in a much lower production, how do I add the template to a scope in
> xpath so
> that the same template is available as a parameter in xmlWhere.
>
> I am sure that a scope will work. I have used the scopes before, but
> don't
> know
> how to keep a template in the scope and use it again.
> how do I reference the 'decl' from 'decl+=declaration' in the child
> production.
>
> Is it even possible to reference upwards?
>
> Thanks
> Regards
> Craig.
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address
More information about the antlr-interest
mailing list