add multi line support for more stuff

This commit is contained in:
2025-06-05 15:13:57 +01:00
parent acc432ed79
commit c0ee99fd54
6 changed files with 64 additions and 15 deletions

View File

@@ -65,6 +65,8 @@ ParsedValue *parse_declaration(char *file, DArray *tokens, size_t *index) {
darray_push(declaration->parameters, &parameter_name);
(*index)++;
error_if_finished(file, tokens, index);
skip_newlines_and_indents(tokens, index);
error_if_finished(file, tokens, index);
token = darray_get(tokens, *index);
if (token->type == TOKEN_RPAREN) {
(*index)++;
@@ -89,6 +91,11 @@ ParsedValue *parse_declaration(char *file, DArray *tokens, size_t *index) {
free(declaration->from);
declaration->from = parse_token(file, tokens, index, true);
if (!declaration->from) {
fprintf(stderr, "%s:%zu:%zu error: syntax error\n", file, token->line,
token->column);
exit(EXIT_FAILURE);
}
if ((*index) >= tokens->size)
break;
token = darray_get(tokens, *index);
@@ -97,6 +104,8 @@ ParsedValue *parse_declaration(char *file, DArray *tokens, size_t *index) {
break;
(*index)++;
error_if_finished(file, tokens, index);
skip_newlines_and_indents(tokens, index);
error_if_finished(file, tokens, index);
token = darray_get(tokens, *index);
}
return parsedValue;