summaryrefslogtreecommitdiff
path: root/parse/tok.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-09-16 02:53:37 -0400
committerOri Bernstein <ori@eigenstate.org>2014-09-16 02:53:37 -0400
commit0070a304765ec8e3ec4a4167ebc5aaf2aa27ecf1 (patch)
tree5996eb5650d23224d00077236f04c04658894339 /parse/tok.c
parent2c2229feed311591c4046e8d351f75fe9b426a93 (diff)
downloadmc-0070a304765ec8e3ec4a4167ebc5aaf2aa27ecf1.tar.gz
Track line number correctly in tokenizer
When we had a '\' escaping a newline, this would skip counting the escaped newline.
Diffstat (limited to 'parse/tok.c')
-rw-r--r--parse/tok.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/parse/tok.c b/parse/tok.c
index f7d4114..d29e761 100644
--- a/parse/tok.c
+++ b/parse/tok.c
@@ -140,7 +140,11 @@ static void eatspace(void)
} 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();