]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
reserve the keywords 'switch,struct,union,break,continue' - but only with std !=...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 1 Nov 2012 13:20:58 +0000 (14:20 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 1 Nov 2012 13:20:58 +0000 (14:20 +0100)
lexer.c

diff --git a/lexer.c b/lexer.c
index 634f90ca348da3584998bd94f3e83425820f61c9..d5f22a3d5b6f1e967d706f8ab03a31f9931dc60b 100644 (file)
--- 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;
     }