[antlr-interest] Rewrite to templates broken?

Xavier xverges at gmail.com
Sun Jan 27 16:17:40 PST 2008


I'm able to avoid the effects mentioned in my earlier post by using

file:	(line NewLine)* line? EOF;

line:   nonComment? comment?
                {
                         Console.Out.WriteLine("[line]" + $text + "[/line]");
                 }
                 ->template(out={$text}) "[line]<out>[/line]"



On Jan 27, 2008 11:37 PM, Xavier <xverges at gmail.com> wrote:
> 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
>



-- 
-Xavier


More information about the antlr-interest mailing list