[antlr-interest] Write comments to templates
Chris Sekszczynska
Development at ChrisSek.de
Sun Nov 23 03:10:02 PST 2008
Hi Gavin,
in general, a good idea. This would simplify the parser. But what's
about the walker? After splicing the ASTs, the walker has to expect an
^(comment ...) subtree everywhere (or at least after / before every
statement).
Is it possible to let the walker walk two ASTs? Synchronization can be
achieved by using the TokenWithIndex class, for example. But how to
implement this? Is there a method which I have to overwrite? How
complex this would be?
Kind regards,
Chris
Am 23.11.2008 um 09:58 schrieb Gavin Lambert:
> I haven't actually done it myself, so I don't know the
> specifics. But it's possible to put the comments on a separate
> channel (not the hidden channel) and then either use a separate
> parser "tuned" to that channel (so it only sees the comments) and
> then splice the ASTs together outside of ANTLR, or to scan through
> the token stream in your standard parser between two known
> reference points looking for off-channel tokens to include.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081123/e3e33ac5/attachment.html
More information about the antlr-interest
mailing list