Make control codes with escape sequences into printable characters. From Arne
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Fri, 9 Feb 2007 05:02:30 +0000 (05:02 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Fri, 9 Feb 2007 05:02:30 +0000 (05:02 +0000)
Goedeke.

git-svn-id: http://svn.complang.org/ragel/trunk@91 052ea7fc-9027-0410-9066-f65837a77df0

common/common.h
rlcodegen/gvdotgen.cpp

index 0c61e65..29dcf38 100644 (file)
@@ -61,7 +61,10 @@ public:
 
        bool isUpper() const { return ( 'A' <= key && key <= 'Z' ); }
        bool isLower() const { return ( 'a' <= key && key <= 'z' ); }
-       bool isPrintable() const { return ( 32 <= key && key < 127 ); }
+       bool isPrintable() const
+       {
+           return ( 7 <= key && key <= 13 ) || ( 32 <= key && key < 127 );
+       }
 
        Key toUpper() const
                { return Key( 'A' + ( key - 'a' ) ); }
index 0f87a26..6aa7e76 100644 (file)
@@ -36,6 +36,27 @@ std::ostream &GraphvizDotGen::KEY( Key key )
                        case '"': case '\\':
                                out << "\\" << cVal;
                                break;
+                       case '\a':
+                               out << "\\\\a";
+                               break;
+                       case '\b':
+                               out << "\\\\b";
+                               break;
+                       case '\t':
+                               out << "\\\\t";
+                               break;
+                       case '\n':
+                               out << "\\\\n";
+                               break;
+                       case '\v':
+                               out << "\\\\v";
+                               break;
+                       case '\f':
+                               out << "\\\\f";
+                               break;
+                       case '\r':
+                               out << "\\\\r";
+                               break;
                        default:        
                                out << cVal;
                                break;