]> de.git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - lexer.c
Merge branch 'master' into ftepp
[xonotic/gmqcc.git] / lexer.c
diff --git a/lexer.c b/lexer.c
index 8558404f1dfbc17a7ffd80855cb0c052835f2beb..34da7d8a97fa1cf107ceef47cb9be2a3518dc9b7 100644 (file)
--- a/lexer.c
+++ b/lexer.c
@@ -13,7 +13,10 @@ void lexerror(lex_file *lex, const char *fmt, ...)
        va_list ap;
 
        va_start(ap, fmt);
-    con_vprintmsg(LVL_ERROR, lex->name, lex->sline, "parse error", fmt, ap);
+       if (lex)
+        con_vprintmsg(LVL_ERROR, lex->name, lex->sline, "parse error", fmt, ap);
+    else
+        con_vprintmsg(LVL_ERROR, "", 0, "parse error", fmt, ap);
        va_end(ap);
 }
 
@@ -412,13 +415,17 @@ static int lex_skipwhite(lex_file *lex)
 
                 if (lex->flags.preprocessing) {
                     haswhite = true;
+                    /*
                     lex_tokench(lex, '/');
                     lex_tokench(lex, '/');
+                    */
+                    lex_tokench(lex, ' ');
+                    lex_tokench(lex, ' ');
                 }
 
                 while (ch != EOF && ch != '\n') {
                     if (lex->flags.preprocessing)
-                        lex_tokench(lex, ch);
+                        lex_tokench(lex, ' '); /* ch); */
                     ch = lex_getch(lex);
                 }
                 if (lex->flags.preprocessing) {
@@ -433,8 +440,12 @@ static int lex_skipwhite(lex_file *lex)
                 /* multiline comment */
                 if (lex->flags.preprocessing) {
                     haswhite = true;
+                    /*
                     lex_tokench(lex, '/');
                     lex_tokench(lex, '*');
+                    */
+                    lex_tokench(lex, ' ');
+                    lex_tokench(lex, ' ');
                 }
 
                 while (ch != EOF)
@@ -444,14 +455,18 @@ static int lex_skipwhite(lex_file *lex)
                         ch = lex_getch(lex);
                         if (ch == '/') {
                             if (lex->flags.preprocessing) {
+                                /*
                                 lex_tokench(lex, '*');
                                 lex_tokench(lex, '/');
+                                */
+                                lex_tokench(lex, ' ');
+                                lex_tokench(lex, ' ');
                             }
                             break;
                         }
                     }
                     if (lex->flags.preprocessing) {
-                        lex_tokench(lex, ch);
+                        lex_tokench(lex, ' '); /* ch); */
                     }
                 }
                 ch = ' '; /* cause TRUE in the isspace check */
@@ -686,6 +701,7 @@ int lex_do(lex_file *lex)
             break;
         }
         /* we reached a linemerge */
+        lex_tokench(lex, '\n');
         continue;
     }