[antlr-interest] [C target] Duplicating tree error

Юрушкин Михаил yurushkin at rambler.ru
Thu Jan 21 03:56:53 PST 2010


Excuse me, what you mean behind "you need to use a label"? Could you send  
me
example?

And, currently, I haven't seen problems with duplicating of "entity_decl"  
tree.
I have a fault with a coping of "declaration_type_spec" tree.


Gavin Lambert <antlr at mirality.co.nz> писал(а) в своём письме Thu, 21 Jan  
2010 14:42:01 +0300:

> At 00:21 22/01/2010, =?koi8-r?B?4NLV28vJziDtycjBycw=?= wrote:
>  >type_declaration_stmt
>  >   : label? declaration_type_spec ( (T_COMMA  attr_spec )*
>  >T_COLON_COLON )?
>  >     entity_decl (T_COMMA entity_decl)* end_of_stmt    	
>  >     -> ^(T_TYPE_DECLARATION_STMT declaration_type_spec attr_spec*
>  >entity_decl)+
>  >   ;
> [...]
>  >BUT declaration_type_spec subtree isn't dublicated (only the root
>  >of subtree).
>  >
>  >Where is mistake?
>
> IIRC, when you use a rule name in a rewrite rule, it represents "the  
> first unused instance of this rule in the input" (which is why  
> entity_decl is doing what it is).  So the second and subsequent times it  
> appears (during the + loop) the value is empty since it didn't occur any  
> more times in the input.  To duplicate nodes you need to use a label.
>
>
> __________ Information from ESET Smart Security, version of virus  
> signature database 4792 (20100121) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.esetnod32.ru
>
>
>


-- 
Best regards,
Michael


More information about the antlr-interest mailing list