[antlr-interest] Rewriting Text
Adam Augusta
roxton at gmail.com
Sun Feb 13 06:11:18 PST 2011
On Sun, Feb 13, 2011 at 8:49 AM, Adam Augusta <roxton at gmail.com> wrote:
> spantag: ^(parent=SPAN e=TEXT) {"boo".equals($e.getText())}?
> {adaptor.setChild($parent, 0, adaptor.create(TEXT, "moo"));};
>
> This works. Is there a more elegant way, or is this a reasonable approach?
Sorry, I think I answered my own question.
spantag: ^(SPAN e=TEXT) {"boo".equals($e.getText())}? -> ^(SPAN
{adaptor.create(TEXT, "moo")});
I didn't realize you could use inline code in the rewrite statement this way.
Thanks,
-Adam
More information about the antlr-interest
mailing list