diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-03-01 22:49:05 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-03-01 22:49:05 (GMT) |
commit | 49c5da1d88f605248167f4d95b1dfe08c1f703c7 (patch) | |
tree | 7c7c6ee02daee4f5a2dd3a3fb7b22a5910ec15d2 /Parser/parser.c | |
parent | 3ffa59b137a0c1f80b5fd495cc3d25d4ef21e0c0 (diff) | |
download | cpython-49c5da1d88f605248167f4d95b1dfe08c1f703c7.zip cpython-49c5da1d88f605248167f4d95b1dfe08c1f703c7.tar.gz cpython-49c5da1d88f605248167f4d95b1dfe08c1f703c7.tar.bz2 |
Patch #1440601: Add col_offset attribute to AST nodes.
Diffstat (limited to 'Parser/parser.c')
-rw-r--r-- | Parser/parser.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Parser/parser.c b/Parser/parser.c index 4a5307c..ada6be2 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -105,11 +105,11 @@ PyParser_Delete(parser_state *ps) /* PARSER STACK OPERATIONS */ static int -shift(register stack *s, int type, char *str, int newstate, int lineno) +shift(register stack *s, int type, char *str, int newstate, int lineno, int col_offset) { int err; assert(!s_empty(s)); - err = PyNode_AddChild(s->s_top->s_parent, type, str, lineno); + err = PyNode_AddChild(s->s_top->s_parent, type, str, lineno, col_offset); if (err) return err; s->s_top->s_state = newstate; @@ -117,13 +117,13 @@ shift(register stack *s, int type, char *str, int newstate, int lineno) } static int -push(register stack *s, int type, dfa *d, int newstate, int lineno) +push(register stack *s, int type, dfa *d, int newstate, int lineno, int col_offset) { int err; register node *n; n = s->s_top->s_parent; assert(!s_empty(s)); - err = PyNode_AddChild(n, type, (char *)NULL, lineno); + err = PyNode_AddChild(n, type, (char *)NULL, lineno, col_offset); if (err) return err; s->s_top->s_state = newstate; @@ -213,7 +213,7 @@ future_hack(parser_state *ps) int PyParser_AddToken(register parser_state *ps, register int type, char *str, - int lineno, int *expected_ret) + int lineno, int col_offset, int *expected_ret) { register int ilabel; int err; @@ -245,7 +245,7 @@ PyParser_AddToken(register parser_state *ps, register int type, char *str, dfa *d1 = PyGrammar_FindDFA( ps->p_grammar, nt); if ((err = push(&ps->p_stack, nt, d1, - arrow, lineno)) > 0) { + arrow, lineno, col_offset)) > 0) { D(printf(" MemError: push\n")); return err; } @@ -255,7 +255,7 @@ PyParser_AddToken(register parser_state *ps, register int type, char *str, /* Shift the token */ if ((err = shift(&ps->p_stack, type, str, - x, lineno)) > 0) { + x, lineno, col_offset)) > 0) { D(printf(" MemError: shift.\n")); return err; } |