On Thu, Jul 16, 2009 at 9:53 PM, Gavin Lambert <[email protected]> wrote:
> At 02:10 17/07/2009, Benoit Fouletier wrote:
>
>> (VAR ID -> VAR ID)
>> (
>> ASSIGN INT
>> ->COLON TYPE["int"] ASSIGN INT
>> |ASSIGN StringValue
>> ->COLON TYPE["string"] ASSIGN StringValue
>> )
>>
>> Do I have the syntax wrong, or are partial rewrites simply not possible?
>>
>
> A rewrite always sets the output of the entire rule. You cannot use it for
> only part of the rule. This is important for iterative rules which need to
> build up a nested chain of nodes.
>
Ah, makes sense!
> (A workaround is to move the bit that you want to do a partial rewrite for
> into a subrule.)
>
Thanks I'll do that. It's simple and maybe even more elegant than the syntax
I had in mind.
BTW, should I mark these kind of subrule as fragments? I don't really get
when to use fragment.
Anyway thanks!
Ben
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address