[antlr-interest] insert after tree?

Harald M. Müller harald_m_mueller at gmx.de
Sun Jan 6 09:04:04 PST 2008


Sorry - I don't understand your question: 
- You have an AST?
- you want to output it again as text?
- but after some sub-AST of it, you want to have written some additional
text?
 
or
 
- You have an AST
- you want to insert a node behind a certain sub-AST
so that later tree parsers/walkers will see that additional node
 
Is it one of these two - or something differently?
 
Sorry for being a little bit slow ...
Regards
Harald


  _____  

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Geoff hendrey
Sent: Sunday, January 06, 2008 9:22 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] insert after tree?


>From my Java program, I want to insert text after a *tree* not after a
token.

I guess I am looking for a "TreeRewriteStream" as opposed to a
TokenRewriteStream. 

As a workaroud I tried creating an imaginary token in my grammar file and
using it to identify the rightmost side of a tree. Like this:

a 'func' a ->^('func' a+ IMAGINARY)

But then as I found out, the IMAGINARY Token doesn't seem to work with
TokenRewriteStream.insertAfter.

Can anybody advise on how I can insert text immediately after a particular
tree? (The text is static so perhaps there is a way to do it from the
grammar file...)



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080106/1954b4e0/attachment.html 


More information about the antlr-interest mailing list