From d6a826cccb34b2ba2559214cce2dc2f4755f07b3 Mon Sep 17 00:00:00 2001 From: thurston Date: Fri, 9 Feb 2007 05:02:30 +0000 Subject: [PATCH] Make control codes with escape sequences into printable characters. From Arne Goedeke. git-svn-id: http://svn.complang.org/ragel/trunk@91 052ea7fc-9027-0410-9066-f65837a77df0 --- common/common.h | 5 ++++- rlcodegen/gvdotgen.cpp | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/common/common.h b/common/common.h index 0c61e65..29dcf38 100644 --- a/common/common.h +++ b/common/common.h @@ -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' ) ); } diff --git a/rlcodegen/gvdotgen.cpp b/rlcodegen/gvdotgen.cpp index 0f87a26..6aa7e76 100644 --- a/rlcodegen/gvdotgen.cpp +++ b/rlcodegen/gvdotgen.cpp @@ -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; -- 2.7.4