[antlr-interest] Skipping or ignoring whole subtrees in a tree grammar
Hardy, Stephen
Stephen_Hardy at rabbit.com
Mon Aug 13 10:43:52 PDT 2007
Maybe you needed
^('fun' TYPE ID .+)
since ". ." would only match two subtrees, which would only be the case
if you had exactly one "param". As I understand it, the * or +
modifiers create flat lists, not a single root node with * or + number
of subtrees, since the dummy "nil" root gets flattened out by rule
post-processing.
Regards,
SJH
> -----Original Message-----
> From: Frank Smith [mailto:fasmith718 at gmail.com]
> Sent: Monday, August 13, 2007 10:37 AM
> To: Hardy, Stephen
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Skipping or ignoring whole
> subtrees in a tree grammar
>
> The wildcard is an interesting beast.
>
> Only use it on the bare minimum amount of stuff in your
> grammar (e.g. only the rule you need skipped!), because I had
> some seemingly unrelated errors crop up in my grammar that I
> ended up tracing back to overusing the wildcard in some rules.
>
> in my case it was:
>
> ^('fun' TYPE ID param* block)
>
> worked perfectly with:
> ^('fun' TYPE ID param* .)
>
> and caused all kinds of heartache with:
> ^('fun' TYPE ID . .)
>
> so even though i didn't use param in the action that followed
> i left it in there for the sake of it actually working :)
>
> good luck with yours
More information about the antlr-interest
mailing list