diff options
Diffstat (limited to 'Parser/parser.c')
-rw-r--r-- | Parser/parser.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/Parser/parser.c b/Parser/parser.c index 41072c4..a9916d3 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -105,11 +105,13 @@ PyParser_Delete(parser_state *ps) /* PARSER STACK OPERATIONS */ static int -shift(stack *s, int type, char *str, int newstate, int lineno, int col_offset) +shift(stack *s, int type, char *str, int newstate, int lineno, int col_offset, + int end_lineno, int end_col_offset) { int err; assert(!s_empty(s)); - err = PyNode_AddChild(s->s_top->s_parent, type, str, lineno, col_offset); + err = PyNode_AddChild(s->s_top->s_parent, type, str, lineno, col_offset, + end_lineno, end_col_offset); if (err) return err; s->s_top->s_state = newstate; @@ -117,13 +119,15 @@ shift(stack *s, int type, char *str, int newstate, int lineno, int col_offset) } static int -push(stack *s, int type, dfa *d, int newstate, int lineno, int col_offset) +push(stack *s, int type, dfa *d, int newstate, int lineno, int col_offset, + int end_lineno, int end_col_offset) { int err; node *n; n = s->s_top->s_parent; assert(!s_empty(s)); - err = PyNode_AddChild(n, type, (char *)NULL, lineno, col_offset); + err = PyNode_AddChild(n, type, (char *)NULL, lineno, col_offset, + end_lineno, end_col_offset); if (err) return err; s->s_top->s_state = newstate; @@ -225,7 +229,9 @@ future_hack(parser_state *ps) int PyParser_AddToken(parser_state *ps, int type, char *str, - int lineno, int col_offset, int *expected_ret) + int lineno, int col_offset, + int end_lineno, int end_col_offset, + int *expected_ret) { int ilabel; int err; @@ -257,7 +263,8 @@ PyParser_AddToken(parser_state *ps, int type, char *str, dfa *d1 = PyGrammar_FindDFA( ps->p_grammar, nt); if ((err = push(&ps->p_stack, nt, d1, - arrow, lineno, col_offset)) > 0) { + arrow, lineno, col_offset, + end_lineno, end_col_offset)) > 0) { D(printf(" MemError: push\n")); return err; } @@ -267,7 +274,8 @@ PyParser_AddToken(parser_state *ps, int type, char *str, /* Shift the token */ if ((err = shift(&ps->p_stack, type, str, - x, lineno, col_offset)) > 0) { + x, lineno, col_offset, + end_lineno, end_col_offset)) > 0) { D(printf(" MemError: shift.\n")); return err; } |