[antlr-interest] Bug in antlr-3.0.1 DOTTreeGenerator.getNodeST()

Terence Parr parrt at cs.usfca.edu
Mon Nov 5 11:16:52 PST 2007


On Nov 3, 2007, at 9:17 AM, Pranab Dhar wrote:

> Hi,
>
>      In the 3.0.1 release of antlr, the DOTTreeGenerator  escapes  
> “  with \  but   not    \  character like \\ . As a result token  
> string that includes \”  is incorrectly escaped to \\” instead of \\\”
>
>
>
> The current code shows this
>
>
>
> if (text!=null) text = text.replaceAll("\"", "\\\\\"");
>
>
>
> and this should be
>
>
>
> if (text!=null) text = text.replaceAll("(\\\\|\")","\\\\$1");
hi. What's $1?

\\\\\" yields \\" in output; hmm...i guess we want \" in output so we  
need \\\" instead?

Also I need a "\\\\ -> "\\" right?

Ter



More information about the antlr-interest mailing list