Hello Matt,

You have a different approach then what I did. Maybe it helps you if I
tell you how I do it?

What I do is I parse the the source file using tree grammar completely
but do not execute any real actions, except registering some symbols,
checking a few types etc. Then I reparse from a certain point (in my
case a main function) and from there I actually execute actions.

I do not use a new parser but use the same parser I already have, in
my case I remember the start of my main function using input.index()
and when I need to reparse I push it on the nodestream with:
nodeStream.push(index), from there a second parsing 'round' is started
but then I execute real actions. I do use the BufferedTreeNodeStream
for it to be able push/pop (thus reparse) instead of the
CommonNodeStream. Hence the solution with boolean stack in my case
works as in the second parse I can check that and decide to actually
do something (execute the contents of the if statement) or not. But
see the other thread for details, the second solution Gavin suggested
does not work for me so far. Perhaps if you remember the index of your
block you can do the same and push it in your if on success, not sure
though.

Martijn

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to