ignore indentation on empty lines
This commit is contained in:
@@ -83,11 +83,14 @@ ParsedValue *parse_token(char *file, DArray *tokens, size_t *index,
|
|||||||
(*index)++;
|
(*index)++;
|
||||||
return NULL;
|
return NULL;
|
||||||
case TOKEN_INDENT:
|
case TOKEN_INDENT:
|
||||||
if (strlen(token->value) > 0) {
|
if (strlen(token->value) > 0 && (*index + 1) < tokens->size) {
|
||||||
|
token = darray_get(tokens, (*index) + 1);
|
||||||
|
if (token->type != TOKEN_NEW_LINE) {
|
||||||
fprintf(stderr, "%s:%zu:%zu error: invalid indentation\n", file,
|
fprintf(stderr, "%s:%zu:%zu error: invalid indentation\n", file,
|
||||||
token->line, token->column);
|
token->line, token->column);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
(*index)++;
|
(*index)++;
|
||||||
return NULL;
|
return NULL;
|
||||||
case TOKEN_IDENTIFIER:
|
case TOKEN_IDENTIFIER:
|
||||||
|
|||||||
Reference in New Issue
Block a user