mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-23 20:33:05 +00:00
lex->flags.preprocessing causes the lexer to parse the unary number if it is one
This commit is contained in:
parent
654eceb33b
commit
6c076f99f6
1 changed files with 11 additions and 0 deletions
11
lexer.c
11
lexer.c
|
@ -1299,6 +1299,17 @@ int lex_do(lex_file *lex)
|
|||
lex_tokench(lex, nextch);
|
||||
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
|
||||
lex_ungetch(lex, nextch);
|
||||
|
||||
|
|
Loading…
Reference in a new issue