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:
Wolfgang (Blub) Bumiller 2012-11-01 14:20:58 +01:00
parent 415816e4dc
commit edd9ded23c

14
lexer.c
View file

@ -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;
}