Allow empty blocks and merged single-line blocks

This commit is contained in:
K. Lange 2020-12-29 12:26:26 +09:00
parent 32d7d6f666
commit 30cd3fb150

View File

@ -164,7 +164,9 @@ static void advance() {
#ifdef ENABLE_SCAN_TRACING
if (vm.flags & KRK_ENABLE_SCAN_TRACING) {
fprintf(stderr, "Token %d '%.*s' on line %d\n", parser.current.type,
fprintf(stderr, "Token %d (start=%p, length=%d) '%.*s' on line %d\n", parser.current.type,
parser.current.start,
(int)parser.current.length,
(int)parser.current.length,
parser.current.start,
(int)parser.current.line);
@ -456,12 +458,13 @@ static void block(size_t indentation) {
(int)currentIndentation);
}
}
#endif
} else {
errorAtCurrent("Expected indentation for block");
fprintf(stderr, "Block is emtpy.\n");
#endif
}
} else {
errorAtCurrent("Unsupported single-line block");
statement();
endOfLine();
}
}