From fd24623c27c5ebf45a033b8c71fc4f4af2ff5ce2 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Fri, 17 Dec 2021 21:07:12 +0100 Subject: [PATCH] parser: Set the position of a call to the open parenthesis --- src/parser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/parser.c b/src/parser.c index 5659b4f..9e36ba4 100644 --- a/src/parser.c +++ b/src/parser.c @@ -394,6 +394,7 @@ err_unexpected_eof_after(enum apfl_token_type token_type, struct apfl_position p static bool fragments_to_call( apfl_parser_ptr, struct fragment_list *, + struct apfl_position position, struct apfl_expr * ); @@ -464,7 +465,7 @@ parse_parens(apfl_parser_ptr p, struct fragment *out, struct apfl_position posit out->type = FRAG_EXPR; out->position = position; - if (!fragments_to_call(p, &children, &out->expr)) { + if (!fragments_to_call(p, &children, position, &out->expr)) { goto error; } @@ -1307,12 +1308,13 @@ static bool fragments_to_call( apfl_parser_ptr p, struct fragment_list *fragments, // \mystuff\TODO:really a pointer? Why? + struct apfl_position position, struct apfl_expr *out ) { assert(fragments->len > 0); // \mystuff\TODO: Or should we check this here? out->type = APFL_EXPR_CALL; - out->position = fragments->children[0].position; + out->position = position; out->call.arguments = (struct apfl_expr_list) { .items = NULL, .len = 0, @@ -1382,7 +1384,7 @@ parse_body_or_toplevel_finalize( goto error; } } else { - if (!fragments_to_call(p, fragments, dest)) { + if (!fragments_to_call(p, fragments, fragments->children[0].position, dest)) { goto error; } }