mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-31 15:01:01 +00:00
reserve the keywords 'switch,struct,union,break,continue' - but only with std != QCC - eg. id1 uses a function named 'break'
This commit is contained in:
parent
415816e4dc
commit
edd9ded23c
1 changed files with 14 additions and 0 deletions
14
lexer.c
14
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue