lex->flags.preprocessing causes the lexer to parse the unary number if it is one

This commit is contained in:
Wolfgang Bumiller 2013-01-02 17:38:24 +01:00
parent 654eceb33b
commit 6c076f99f6

11
lexer.c
View file

@ -1299,6 +1299,17 @@ int lex_do(lex_file *lex)
lex_tokench(lex, nextch); lex_tokench(lex, nextch);
lex_tokench(lex, thirdch); lex_tokench(lex, thirdch);
} }
}
else if (lex->flags.preprocessing &&
ch == '-' && isdigit(nextch))
{
lex->tok.ttype = lex_finish_digit(lex, nextch);
if (lex->tok.ttype == TOKEN_INTCONST)
lex->tok.constval.i = -lex->tok.constval.i;
else
lex->tok.constval.f = -lex->tok.constval.f;
lex_endtoken(lex);
return lex->tok.ttype;
} else } else
lex_ungetch(lex, nextch); lex_ungetch(lex, nextch);