[antlr-interest] Apparently equivalent code refactoring doesn't work

Jim Idle jimi at temporal-wave.com
Wed Jan 30 08:16:40 PST 2008



> -----Original Message-----
> From: Steve Bennett [mailto:stevagewp at gmail.com]
> Sent: Tuesday, January 29, 2008 9:02 PM
> To: antlr-interest
> Subject: [antlr-interest] Apparently equivalent code refactoring
> doesn't work
> 
> Hi all,
> 
> These two code fragments should be effectively equivalent, I think:
> 
> 1:
> 
> internal_link:
>     link_start COLON? pagename (PIPE link_caption?)? link_end
> ((letters)=>link_trail)?
> -> ^(INTERNAL_LINK ^(PAGENAME pagename) ^(TEXT link_caption?
> link_trail?));
> 
> link_caption
> @init {this.caption_levels++;}:
>         simple_text;
> finally {this.caption_levels--; }
> 
> ----
> 
> 2:
> 
> internal_link:
>     link_start COLON? pagename (PIPE link_caption)? link_end
> ((letters)=>link_trail)?
> -> ^(INTERNAL_LINK ^(PAGENAME pagename) ^(TEXT link_caption?
> link_trail?));
> 
> link_caption
> @init {this.caption_levels++; }:
>         simple_text?;
> finally {this.caption_levels--; }
> 
> 
> (the difference being the question mark after 'link_caption' or after
> 'simple_text')
> 

Steve,

You might just try the latest daily build of ANTLR 3.1 and see if that 
changes the behavior.

Jim



More information about the antlr-interest mailing list