]> granicus.if.org Git - re2c/commitdiff
Print single character as char rather than convert it to one-symbol string.
authorUlya Trofimovich <skvadrik@gmail.com>
Mon, 10 Aug 2015 09:26:14 +0000 (10:26 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Mon, 10 Aug 2015 09:26:14 +0000 (10:26 +0100)
re2c/src/codegen/go_emit.cc
re2c/src/codegen/output.cc
re2c/src/codegen/output.h

index ebd9e56cfc5c2c0774e116d8e27bec9a04c7eec7..c196e6460230d9416c0603bf860c7784c981b297 100644 (file)
@@ -72,7 +72,7 @@ void Case::emit (OutputFile & o, uint32_t ind)
                        {
                                const uint32_t c = encoding.decodeUnsafe (b);
                                if (isprint (c))
-                                       o << " /* " << std::string (1, c) << " */";
+                                       o << " /* " << static_cast<char> (c) << " */";
                        }
                        bool last_case = i == ranges.size () - 1 && b == ranges[i].second - 1;
                        if (!last_case)
index e8e26c4d7bf54586b8362e56b286dd50cd2d3cc4..d24ac8f8ee964f3bdf91e27d62b00670a463ca88 100644 (file)
@@ -134,6 +134,12 @@ void OutputFile::write_user_start_label ()
        }
 }
 
+OutputFile & operator << (OutputFile & u, char c)
+{
+       u.stream () << c;
+       return u;
+}
+
 OutputFile & operator << (OutputFile & u, uint32_t n)
 {
        u.stream () << n;
index 1f584da196c2a53089f2ddeeb0208cdd8b65b541..73b0c4ef1cec8cf51686b56dbfd7ef026cb0358c 100644 (file)
@@ -76,6 +76,7 @@ public:
        void write_line_info (uint32_t l, const char * fn);
        void write_version_time ();
        void write_user_start_label ();
+       friend OutputFile & operator << (OutputFile & o, char c);
        friend OutputFile & operator << (OutputFile & o, uint32_t n);
        friend OutputFile & operator << (OutputFile & o, const std::string & s);
        friend OutputFile & operator << (OutputFile & o, const char * s);