summaryrefslogtreecommitdiffstats
path: root/Parser/tokenizer.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-03-01 22:49:05 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-03-01 22:49:05 (GMT)
commit49c5da1d88f605248167f4d95b1dfe08c1f703c7 (patch)
tree7c7c6ee02daee4f5a2dd3a3fb7b22a5910ec15d2 /Parser/tokenizer.c
parent3ffa59b137a0c1f80b5fd495cc3d25d4ef21e0c0 (diff)
downloadcpython-49c5da1d88f605248167f4d95b1dfe08c1f703c7.zip
cpython-49c5da1d88f605248167f4d95b1dfe08c1f703c7.tar.gz
cpython-49c5da1d88f605248167f4d95b1dfe08c1f703c7.tar.bz2
Patch #1440601: Add col_offset attribute to AST nodes.
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r--Parser/tokenizer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 036bed8..4174e9c 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -764,6 +764,7 @@ tok_nextc(register struct tok_state *tok)
}
if (tok->start == NULL)
tok->buf = tok->cur;
+ tok->line_start = tok->cur;
tok->lineno++;
tok->inp = end;
return Py_CHARMASK(*tok->cur++);
@@ -798,6 +799,7 @@ tok_nextc(register struct tok_state *tok)
}
tok->buf = buf;
tok->cur = tok->buf + oldlen;
+ tok->line_start = tok->cur;
strcpy(tok->buf + oldlen, new);
PyMem_FREE(new);
tok->inp = tok->buf + newlen;
@@ -809,7 +811,9 @@ tok_nextc(register struct tok_state *tok)
if (tok->buf != NULL)
PyMem_DEL(tok->buf);
tok->buf = new;
+ tok->line_start = tok->buf;
tok->cur = tok->buf;
+ tok->line_start = tok->buf;
tok->inp = strchr(tok->buf, '\0');
tok->end = tok->inp + 1;
}
@@ -877,6 +881,7 @@ tok_nextc(register struct tok_state *tok)
done = tok->inp[-1] == '\n';
}
tok->cur = tok->buf + cur;
+ tok->line_start = tok->cur;
/* replace "\r\n" with "\n" */
/* For Mac we leave the \r, giving a syntax error */
pt = tok->inp - 2;