]> granicus.if.org Git - re2c/commitdiff
Fixed bug #47: Dot output label escaped characters.
authorUlya Trofimovich <skvadrik@gmail.com>
Fri, 26 Sep 2014 16:14:20 +0000 (17:14 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Fri, 26 Sep 2014 16:14:20 +0000 (17:14 +0100)
Double-escape special characters for dot.
Example:
    17 -> 18 [label="\n"]
results in an "unlabeled" arrow in the rendered graph, but
    17 -> 18 [label="\\n"]
is ok.

re2c/print.cc

index 22aa7c7ca35ebcbdc27d1602b1cb8c63e3f8ac0f..8394cc4dea0dbf44ec93e9a328275e00f9f5460c 100644 (file)
@@ -75,35 +75,35 @@ void prtCh(std::ostream& o, uint c)
                break;
 
                case '\n':
-               o << "\\n";
+               o << (DFlag ? "\\\\n" : "\\n");
                break;
 
                case '\t':
-               o << "\\t";
+               o << (DFlag ? "\\\\t" : "\\t");
                break;
 
                case '\v':
-               o << "\\v";
+               o << (DFlag ? "\\\\v" : "\\v");
                break;
 
                case '\b':
-               o << "\\b";
+               o << (DFlag ? "\\\\b" : "\\b");
                break;
 
                case '\r':
-               o << "\\r";
+               o << (DFlag ? "\\\\r" : "\\r");
                break;
 
                case '\f':
-               o << "\\f";
+               o << (DFlag ? "\\\\f" : "\\f");
                break;
 
                case '\a':
-               o << "\\a";
+               o << (DFlag ? "\\\\a" :"\\a");
                break;
 
                case '\\':
-               o << "\\\\";
+               o << (DFlag ? "\\\\\\\\" : "\\\\");
                break;
 
                default: