From a5900877495acaea30b885373e8e5540883fdebc Mon Sep 17 00:00:00 2001 From: Leandro Melo Date: Thu, 16 Aug 2012 09:33:45 +0200 Subject: [PATCH] C++: Lex correctly a u8"literal" Previously it was considering invalid things `such as U8"literal". Change-Id: Icf4d051a26617ac2c6cb35d5a98f8af0ed801556 Reviewed-by: Roberto Raggi Reviewed-by: hjk --- src/libs/3rdparty/cplusplus/Lexer.cpp | 30 +++++++++++++-------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/libs/3rdparty/cplusplus/Lexer.cpp b/src/libs/3rdparty/cplusplus/Lexer.cpp index 3b52059a36a..5179d83b547 100644 --- a/src/libs/3rdparty/cplusplus/Lexer.cpp +++ b/src/libs/3rdparty/cplusplus/Lexer.cpp @@ -579,25 +579,23 @@ void Lexer::scan_helper(Token *tok) } else if (_yychar == '\'') { yyinp(); scanCharLiteral(tok, ch); - } else { - if (_yychar == '8') { - unsigned char la = 0; - if (_currentChar + 1 != _lastChar) - la = *(_currentChar + 1); - if (la == '"') { - yyinp(); - yyinp(); - scanStringLiteral(tok, '8'); - } else if (la == '\'') { - yyinp(); - yyinp(); - scanCharLiteral(tok, '8'); - } else { - scanIdentifier(tok); - } + } else if (ch == 'u' && _yychar == '8') { + unsigned char la = 0; + if (_currentChar + 1 != _lastChar) + la = *(_currentChar + 1); + if (la == '"') { + yyinp(); + yyinp(); + scanStringLiteral(tok, '8'); + } else if (la == '\'') { + yyinp(); + yyinp(); + scanCharLiteral(tok, '8'); } else { scanIdentifier(tok); } + } else { + scanIdentifier(tok); } } else if (std::isalpha(ch) || ch == '_' || ch == '$') { scanIdentifier(tok);