[antlr-interest] Rewrite to templates broken?

Xavier xverges at gmail.com
Sun Jan 27 14:37:05 PST 2008


I'm getting a different outcome from a rewrite rule and action that I
would expect to do the same.

Am I missing something, or did I hit some bug?

options {
        language=CSharp;
        output=template;
        rewrite=true;
}
file:	line* EOF;
	
line:	nonComment? comment? NewLine
		{
			Console.Out.WriteLine("[line]" + $text + "[/line]");
		}
		->template(out={$text}) "[line]<out>[/line]"


While stdout prints every line enclose by [line]...[/line],
the TokenRewriteStream only encloses every two lines.

I'm generating the code from antlrworks-1.1.5.jar

Thanks in advance.

-Xavier


More information about the antlr-interest mailing list