diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index eaf7b8add..3b401fa29 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2822,9 +2822,9 @@ void Tokenizer::simplifyCaseRange() for (char i = end - 1; i > start; i--) { tok->insertToken(":"); if (i == '\\') { - tok->insertToken(std::string("\'\\") + i + '\''); + tok->insertToken(std::string("\'\\") + i + '\''); } else { - tok->insertToken(std::string(1, '\'') + i + '\''); + tok->insertToken(std::string(1, '\'') + i + '\''); } tok->insertToken("case"); } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 209094064..9989df8bb 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -7114,7 +7114,7 @@ private: ASSERT_EQUALS("void f ( ) { switch ( x ) { case 'a' : case 'b' : case 'c' : ; } }", tokenizeAndStringify("void f() { switch(x) { case 'a' ... 'c': } }")); ASSERT_EQUALS("void f ( ) { switch ( x ) { case 'c' . . . 'a' : ; } }", tokenizeAndStringify("void f() { switch(x) { case 'c' ... 'a': } }")); - + ASSERT_EQUALS("void f ( ) { switch ( x ) { case '[' : case '\\\\' : case ']' : ; } }", tokenizeAndStringify("void f() { switch(x) { case '[' ... ']': } }")); }