add multi line support for more stuff
This commit is contained in:
@@ -65,6 +65,8 @@ ParsedValue *parse_declaration(char *file, DArray *tokens, size_t *index) {
|
||||
darray_push(declaration->parameters, ¶meter_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;
|
||||
|
||||
Reference in New Issue
Block a user