]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - lexer.c
Look for include files in the currently #included file's directory first
[xonotic/gmqcc.git] / lexer.c
diff --git a/lexer.c b/lexer.c
index 5a1f23e43cb7ed56b3127dfb1aead63364080ff7..8f1bcb8a46eb3eb5bd823c91267f5bae01765950 100644 (file)
--- a/lexer.c
+++ b/lexer.c
@@ -834,7 +834,7 @@ static int GMQCC_WARN lex_finish_digit(lex_file *lex, int lastch)
 
 int lex_do(lex_file *lex)
 {
-    int ch, nextch;
+    int ch, nextch, thirdch;
 
     lex_token_new(lex);
 #if 0
@@ -980,9 +980,9 @@ int lex_do(lex_file *lex)
 
         if (!strcmp(v, "flush"))
         {
-            size_t frame;
-            for (frame = 0; frame < vec_size(lex->frames); ++frame)
-                mem_d(lex->frames[frame].name);
+            size_t fi;
+            for (fi = 0; fi < vec_size(lex->frames); ++fi)
+                mem_d(lex->frames[fi].name);
             vec_free(lex->frames);
             /* skip line (fteqcc does it too) */
             ch = lex_getch(lex);
@@ -1022,6 +1022,7 @@ int lex_do(lex_file *lex)
         case '[':
         case '(':
         case ':':
+        case '?':
             lex_tokench(lex, ch);
             lex_endtoken(lex);
             if (lex->flags.noops)
@@ -1113,6 +1114,16 @@ int lex_do(lex_file *lex)
             lex_tokench(lex, nextch);
         } else if (ch == '-' && nextch == '>') {
             lex_tokench(lex, nextch);
+        } else if (ch == '&' && nextch == '~') {
+            thirdch = lex_getch(lex);
+            if (thirdch != '=') {
+                lex_ungetch(lex, thirdch);
+                lex_ungetch(lex, nextch);
+            }
+            else {
+                lex_tokench(lex, nextch);
+                lex_tokench(lex, thirdch);
+            }
         } else
             lex_ungetch(lex, nextch);