diff options
-rw-r--r-- | src/parser.y | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/parser.y b/src/parser.y index 2050f8a3..07613e21 100644 --- a/src/parser.y +++ b/src/parser.y @@ -492,12 +492,16 @@ input : /* empty */ | input line { if ($2 != NULL) { + LIST_HEAD(list); + $2->location = @2; + + list_add_tail(&$2->list, &list); if (cmd_evaluate(&state->ectx, $2) < 0) { if (++state->nerrs == max_errors) YYABORT; } else - list_splice_tail(&$2->list, &state->cmds); + list_splice_tail(&list, &state->cmds); } } ; @@ -554,13 +558,16 @@ line : common_block { $$ = NULL; } * work. */ if ($1 != NULL) { + LIST_HEAD(list); + $1->location = @1; + list_add_tail(&$1->list, &list); if (cmd_evaluate(&state->ectx, $1) < 0) { if (++state->nerrs == max_errors) YYABORT; } else - list_splice_tail(&$1->list, &state->cmds); + list_splice_tail(&list, &state->cmds); } $$ = NULL; |