Commit 3e54a65a authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Replaced T_INT_LITERAL and T_FLOAT_LITERAL with T_NUMERIC_LITERAL.

parent 017d8653
......@@ -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') {
......
......@@ -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) ||
......
......@@ -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;
......
......@@ -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:
......
......@@ -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:
......
......@@ -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,
......
......@@ -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)) {
......
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