Commit a5900877 authored by Leandro Melo's avatar Leandro Melo

C++: Lex correctly a u8"literal"

Previously it was considering invalid things `such as U8"literal".

Change-Id: Icf4d051a26617ac2c6cb35d5a98f8af0ed801556
Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent df0d3c28
...@@ -579,25 +579,23 @@ void Lexer::scan_helper(Token *tok) ...@@ -579,25 +579,23 @@ void Lexer::scan_helper(Token *tok)
} else if (_yychar == '\'') { } else if (_yychar == '\'') {
yyinp(); yyinp();
scanCharLiteral(tok, ch); scanCharLiteral(tok, ch);
} else { } else if (ch == 'u' && _yychar == '8') {
if (_yychar == '8') { unsigned char la = 0;
unsigned char la = 0; if (_currentChar + 1 != _lastChar)
if (_currentChar + 1 != _lastChar) la = *(_currentChar + 1);
la = *(_currentChar + 1); if (la == '"') {
if (la == '"') { yyinp();
yyinp(); yyinp();
yyinp(); scanStringLiteral(tok, '8');
scanStringLiteral(tok, '8'); } else if (la == '\'') {
} else if (la == '\'') { yyinp();
yyinp(); yyinp();
yyinp(); scanCharLiteral(tok, '8');
scanCharLiteral(tok, '8');
} else {
scanIdentifier(tok);
}
} else { } else {
scanIdentifier(tok); scanIdentifier(tok);
} }
} else {
scanIdentifier(tok);
} }
} else if (std::isalpha(ch) || ch == '_' || ch == '$') { } else if (std::isalpha(ch) || ch == '_' || ch == '$') {
scanIdentifier(tok); scanIdentifier(tok);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment