[antlr-interest] How to match a tree without executing the actions

Michael Bedward michael.bedward at gmail.com
Sun Apr 17 20:38:04 PDT 2011


Hello,

I'm not sure if I understand what you are trying to do properly, but
using a global scope with a boolean flag would let you control action
execution without the need pass a parameter down the rule chain.

Michael

On 18 April 2011 00:19, Mu Qiao <qiaomuf at gmail.com> wrote:
> Hi,
>
> I have an AST and a subtree that represents for function definition.
> When I implement the tree walker, I don't want to executing the
> actions in the function body when I match a function definition. I
> know I can pass an argument down indicating whether to execute the
> actions or not. Is there any way that doesn't require any modification
> to other rules except the function definition rule?
>
> I tried to skip the whole function body AST but didn't success because
> it's hard for me to find the last node index of the body. If I can
> have that, I guess SEEK(index + 1) could work for me if I'm right.
>
> Could any one please give me a hand?
>
> --
> Best wishes,
> Mu Qiao
> GnuPG fingerprint: 92B1 B0C4 8D14 F8C4 EFA5  3ACC 30B3 0DE4 17B1 57E9
>
> 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