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

@@ -18,11 +18,11 @@ ParsedValue *parse_assign(char *file, DArray *tokens, ParsedValue *assign_to,
ParsedCall *call = assign_to->data;
for (size_t i = 0; i < call->args->size; i++) {
if (((ParsedValue *)darray_get(call->args, i))->type != AST_IDENTIFIER) {
fprintf(
stderr,
"%s:%zu:%zu error: parameter names need to start with a letter or _, "
"only use letters, digits, or _, and can't be keywords.\n",
file, token->line, token->column);
fprintf(stderr,
"%s:%zu:%zu error: parameter names need to start with a letter "
"or _, "
"only use letters, digits, or _, and can't be keywords.\n",
file, token->line, token->column);
exit(EXIT_FAILURE);
}
}
@@ -39,6 +39,11 @@ ParsedValue *parse_assign(char *file, DArray *tokens, ParsedValue *assign_to,
error_if_finished(file, tokens, index);
token = darray_get(tokens, *index);
assign->from = parse_token(file, tokens, index, true);
if (!assign->from) {
fprintf(stderr, "%s:%zu:%zu error: syntax error\n", file, token->line,
token->column);
exit(EXIT_FAILURE);
}
ParsedValue *parsedValue = checked_malloc(sizeof(ParsedValue));
parsedValue->type = AST_ASSIGN;
parsedValue->data = assign;