aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-09 23:16:23 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-03-09 23:16:23 -0500
commita1605672d94f350ecd764281211774cbcd72d09e (patch)
tree4e496ada150b2933b513c671bb8f08eff0a62e54
parent89d7098654750f35ae63cb751012f8c7d54aa583 (diff)
Add explicit check for space indentation
-rw-r--r--parse.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/parse.c b/parse.c
index f8e7949a..bed73e0b 100644
--- a/parse.c
+++ b/parse.c
@@ -989,8 +989,6 @@ PARSER(parse_text) {
return NULL;
}
- // printf("Parsing string: '%c' .. '%c' interp: '%c%c'\n", *start, close_quote, open_interp, close_interp);
-
int64_t starting_indent = get_indent(ctx->file, pos);
int64_t string_indent = starting_indent + 1;
@@ -1455,6 +1453,12 @@ PARSER(parse_block) {
whitespace(&pos);
ast_list_t *statements = NULL;
while (*pos) {
+ if (pos > start && pos[-1] == ' ') {
+ const char *space_start = pos-1;
+ while (*space_start == ' ')
+ --space_start;
+ parser_err(ctx, space_start, pos, "Spaces are not allowed for indentation, only tabs!");
+ }
ast_t *stmt = optional(ctx, &pos, parse_statement);
if (!stmt) {
const char *line_start = pos;