]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
reset the column counter on a newline
authorWolfgang Bumiller <wry.git@bumiller.com>
Mon, 26 Aug 2013 16:53:09 +0000 (18:53 +0200)
committerWolfgang Bumiller <wry.git@bumiller.com>
Mon, 26 Aug 2013 16:53:09 +0000 (18:53 +0200)
lexer.c

diff --git a/lexer.c b/lexer.c
index feea8a2eb49cf5ce14873df7067d25cb4526e274..af7819dd802016e0870843c5b6b85ded5d5efc59 100644 (file)
--- a/lexer.c
+++ b/lexer.c
@@ -352,14 +352,18 @@ static int lex_getch(lex_file *lex)
 
     if (lex->peekpos) {
         lex->peekpos--;
 
     if (lex->peekpos) {
         lex->peekpos--;
-        if (!lex->push_line && lex->peek[lex->peekpos] == '\n')
+        if (!lex->push_line && lex->peek[lex->peekpos] == '\n') {
             lex->line++;
             lex->line++;
+            lex->column = 0;
+        }
         return lex->peek[lex->peekpos];
     }
 
     ch = lex_fgetc(lex);
         return lex->peek[lex->peekpos];
     }
 
     ch = lex_fgetc(lex);
-    if (!lex->push_line && ch == '\n')
+    if (!lex->push_line && ch == '\n') {
         lex->line++;
         lex->line++;
+        lex->column = 0;
+    }
     else if (ch == '?')
         return lex_try_trigraph(lex, ch);
     else if (!lex->flags.nodigraphs && (ch == '<' || ch == ':' || ch == '%'))
     else if (ch == '?')
         return lex_try_trigraph(lex, ch);
     else if (!lex->flags.nodigraphs && (ch == '<' || ch == ':' || ch == '%'))