]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Better linecounting for pragmas; support for prgama file(filename)
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 18 Nov 2012 14:30:40 +0000 (15:30 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 18 Nov 2012 14:30:49 +0000 (15:30 +0100)
lexer.c

diff --git a/lexer.c b/lexer.c
index 40756c0a4e3d0c93a7f2822ebfa2aa83df1c7b81..ecda7f7ebf0528b577e38a9b8a864ffa2b4df5d9 100644 (file)
--- a/lexer.c
+++ b/lexer.c
@@ -405,16 +405,21 @@ static bool lex_try_pragma(lex_file *lex)
         if (!strcmp(param, "line")) {
             if (lex->push_line)
                 lex->push_line--;
+            --line;
         }
         else
             goto unroll;
     }
+    else if (!strcmp(command, "file")) {
+        lex->name = util_strdup(param);
+        vec_push(lex_filenames, lex->name);
+    }
     else
         goto unroll;
 
+    lex->line = line;
     while (ch != '\n')
         ch = lex_getch(lex);
-    lex->line = line;
     return true;
 
 unroll: