shithub: mc

Download patch

ref: 0070a304765ec8e3ec4a4167ebc5aaf2aa27ecf1
parent: 2c2229feed311591c4046e8d351f75fe9b426a93
author: Ori Bernstein <[email protected]>
date: Mon Sep 15 22:53:37 EDT 2014

Track line number correctly in tokenizer

    When we had a '\' escaping a newline, this would skip counting
    the escaped newline.

--- a/parse/tok.c
+++ b/parse/tok.c
@@ -140,7 +140,11 @@
         } else if (c == '\\') {
             ignorenl = 1;
             next();
-        } else if (isspace(c) || (ignorenl && c == '\n')) {
+        } else if (ignorenl && c == '\n') {
+            next();
+            line++;
+            ignorenl = 0;
+        } else if (isspace(c)) {
             next();
         } else if (c == '/' && peekn(1) == '*') {
             eatcomment();