From a52fdf470aa2c164108aeccc2c83bad62208913c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 9 Mar 2019 14:14:09 +0100 Subject: Start on resolving ast. Add recursive declaration check --- src/parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/parser.c') diff --git a/src/parser.c b/src/parser.c index fcc29be..b91e15a 100644 --- a/src/parser.c +++ b/src/parser.c @@ -231,7 +231,7 @@ static THROWABLE parser_parse_function_call_or_variable(Parser *self, Ast *expr) if(!match) { Variable *variable; throw_if_error(scoped_allocator_alloc(self->allocator, sizeof(Variable), (void**)&variable)); - variable->name = identifier; + variable_init(variable, identifier); expr->type = AST_VARIABLE; expr->value.variable = variable; return PARSER_OK; @@ -471,7 +471,7 @@ int parser_parse_buffer(Parser *self, BufferView code_buffer, BufferView buffer_ tokenizer_print_error_object(&self->tokenizer, &self->error); break; case ERROR_CONTEXT_RHS_START: - tokenizer_print_error(&self->tokenizer, "Expected string, variable, closure, function call or import"); + tokenizer_print_error(&self->tokenizer, self->tokenizer.prev_index, "Expected string, variable, closure, function call or import"); break; default: assert(bool_false && "Error context handling not implemented"); -- cgit v1.2.3