diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 5be562dcfa23e0aff44f1f171212261142c84d01..35ddf3ace8209aeed273ce2e4e8d2fbff518ad42 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -240,7 +240,7 @@ protected: bool process_primary() { - if ((*_lex)->is(T_INT_LITERAL)) { + if ((*_lex)->is(T_NUMERIC_LITERAL)) { int base = 10; const QByteArray spell = tokenSpell(); if (spell.at(0) == '0') { diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index 4a60414ba11d7ca0b131f7e7ce6a888bc5a9fbe6..2f016c4d37d6f6c26d535e0c0f4b9cd5362875ff 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -125,7 +125,7 @@ void CppHighlighter::highlightBlock(const QString &text) (tk.isKeyword() || tk.is(T_IDENTIFIER)) && isPPKeyword(tk.text())) setFormat(tk.position(), tk.length(), m_formats[CppPreprocessorFormat]); - else if (tk.is(T_INT_LITERAL) || tk.is(T_FLOAT_LITERAL)) + else if (tk.is(T_NUMERIC_LITERAL)) setFormat(tk.position(), tk.length(), m_formats[CppNumberFormat]); else if (tk.is(T_STRING_LITERAL) || tk.is(T_CHAR_LITERAL) || tk.is(T_ANGLE_STRING_LITERAL) || diff --git a/src/shared/cplusplus/Lexer.cpp b/src/shared/cplusplus/Lexer.cpp index f463201f716882e68ce9a9d3816d35ef75275dd9..2229b470bd225707b7c2d501a0f77479d531687b 100644 --- a/src/shared/cplusplus/Lexer.cpp +++ b/src/shared/cplusplus/Lexer.cpp @@ -348,7 +348,7 @@ void Lexer::scan_helper(Token *tok) } } while (_yychar); int yylen = _currentChar - yytext; - tok->kind = T_INT_LITERAL; + tok->kind = T_NUMERIC_LITERAL; if (control()) tok->number = control()->findOrInsertNumericLiteral(yytext, yylen); } else { @@ -702,7 +702,7 @@ void Lexer::scan_helper(Token *tok) } } int yylen = _currentChar - yytext; - tok->kind = T_INT_LITERAL; + tok->kind = T_NUMERIC_LITERAL; if (control()) tok->number = control()->findOrInsertNumericLiteral(yytext, yylen); break; diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index 96e7f86cc202e1ef628a74c95acf0eb68a3bcd14..a005f7250bbc7aa67c421cfd8bfa46145dfcb1fb 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -2715,8 +2715,9 @@ bool Parser::parseBoolLiteral(ExpressionAST *&node) bool Parser::parseNumericLiteral(ExpressionAST *&node) { - if (LA() == T_INT_LITERAL || LA() == T_FLOAT_LITERAL || - LA() == T_CHAR_LITERAL || LA() == T_WIDE_CHAR_LITERAL) { + if (LA() == T_NUMERIC_LITERAL || + LA() == T_CHAR_LITERAL || + LA() == T_WIDE_CHAR_LITERAL) { NumericLiteralAST *ast = new (_pool) NumericLiteralAST; ast->literal_token = consumeToken(); node = ast; @@ -2743,10 +2744,9 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node) case T_WIDE_STRING_LITERAL: return parseStringLiteral(node); - case T_INT_LITERAL: - case T_FLOAT_LITERAL: - case T_CHAR_LITERAL: + case T_CHAR_LITERAL: // ### FIXME don't use NumericLiteral for chars case T_WIDE_CHAR_LITERAL: + case T_NUMERIC_LITERAL: return parseNumericLiteral(node); case T_TRUE: diff --git a/src/shared/cplusplus/Token.cpp b/src/shared/cplusplus/Token.cpp index 37a95d6cd772d4c12bb5986ef1454ad27e25a6bf..bda5ecc5839d243c21c5cfb86f5486c20b2c3231 100644 --- a/src/shared/cplusplus/Token.cpp +++ b/src/shared/cplusplus/Token.cpp @@ -118,8 +118,7 @@ const char *Token::spell() const case T_IDENTIFIER: return identifier->chars(); - case T_INT_LITERAL: - case T_FLOAT_LITERAL: + case T_NUMERIC_LITERAL: case T_CHAR_LITERAL: case T_STRING_LITERAL: case T_AT_STRING_LITERAL: diff --git a/src/shared/cplusplus/Token.h b/src/shared/cplusplus/Token.h index 6774dba3361d8528a0cfa917c5a7b1d4455ca845..99b986c7abb49b1ecea7007e424efbce4b8b1c3a 100644 --- a/src/shared/cplusplus/Token.h +++ b/src/shared/cplusplus/Token.h @@ -64,8 +64,7 @@ enum Kind { T_IDENTIFIER, T_FIRST_LITERAL, - T_INT_LITERAL = T_FIRST_LITERAL, - T_FLOAT_LITERAL, + T_NUMERIC_LITERAL = T_FIRST_LITERAL, T_CHAR_LITERAL, T_WIDE_CHAR_LITERAL, T_STRING_LITERAL, diff --git a/src/shared/cplusplus/TranslationUnit.cpp b/src/shared/cplusplus/TranslationUnit.cpp index db5fbe1c054f13dec469d9dfcf421ff1b0c412ee..64145342b86c6660b26a6ca42a332ae9cc749b25 100644 --- a/src/shared/cplusplus/TranslationUnit.cpp +++ b/src/shared/cplusplus/TranslationUnit.cpp @@ -208,7 +208,7 @@ void TranslationUnit::tokenize() } else { if (! tk.newline && tk.is(T_IDENTIFIER) && tk.identifier == lineId) lex(&tk); - if (! tk.newline && tk.is(T_INT_LITERAL)) { + if (! tk.newline && tk.is(T_NUMERIC_LITERAL)) { unsigned line = (unsigned) strtoul(tk.spell(), 0, 0); lex(&tk); if (! tk.newline && tk.is(T_STRING_LITERAL)) {