From: Wolfgang (Blub) Bumiller Date: Thu, 1 Nov 2012 13:20:58 +0000 (+0100) Subject: reserve the keywords 'switch,struct,union,break,continue' - but only with std !=... X-Git-Tag: 0.1-rc1~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=edd9ded23cce132f72671a7a277aece026d305fa;p=xonotic%2Fgmqcc.git reserve the keywords 'switch,struct,union,break,continue' - but only with std != QCC - eg. id1 uses a function named 'break' --- diff --git a/lexer.c b/lexer.c index 634f90c..d5f22a3 100644 --- a/lexer.c +++ b/lexer.c @@ -991,7 +991,21 @@ int lex_do(lex_file *lex) !strcmp(v, "local") || !strcmp(v, "return") || !strcmp(v, "const")) + { lex->tok.ttype = TOKEN_KEYWORD; + } + else if (opts_standard != COMPILER_QCC) + { + /* other standards reserve these keywords */ + if (!strcmp(v, "switch") || + !strcmp(v, "struct") || + !strcmp(v, "union") || + !strcmp(v, "break") || + !strcmp(v, "continue")) + { + lex->tok.ttype = TOKEN_KEYWORD; + } + } return lex->tok.ttype; }