From: Wolfgang Bumiller Date: Wed, 2 Jan 2013 16:38:24 +0000 (+0100) Subject: lex->flags.preprocessing causes the lexer to parse the unary number if it is one X-Git-Tag: before-library~374^2 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=commitdiff_plain;h=6c076f99f642766814d14ce408bc234c8bad7427 lex->flags.preprocessing causes the lexer to parse the unary number if it is one --- diff --git a/lexer.c b/lexer.c index 5e0414b..64cdb3d 100644 --- a/lexer.c +++ b/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);