Allow lisp-style comments in tree queries

This commit is contained in:
Max Brunsfeld 2019-09-11 12:16:05 -07:00
parent 4fa0b02d67
commit 33f89522f6
2 changed files with 73 additions and 33 deletions

View file

@ -147,7 +147,18 @@ static Stream stream_new(const char *string, uint32_t length) {
}
static void stream_skip_whitespace(Stream *stream) {
while (iswspace(stream->next)) stream_advance(stream);
for (;;) {
if (iswspace(stream->next)) {
stream_advance(stream);
} else if (stream->next == ';') {
stream_advance(stream);
while (stream->next && stream->next != '\n') {
if (!stream_advance(stream)) break;
}
} else {
break;
}
}
}
static bool stream_is_ident_start(Stream *stream) {