aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-12 17:27:59 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-12 17:27:59 -0400
commitbdf7c369edca612335e5b5edd24cab6be64c841d (patch)
tree7f7d839cb16b48392e12c47b9128c2ff0e1360cb
parentd2f4d07585d1e915365f3aaea6fc696e00a9e26d (diff)
Bugfix for parsing comments
-rw-r--r--parse.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/parse.c b/parse.c
index f58a0928..836d63d7 100644
--- a/parse.c
+++ b/parse.c
@@ -374,7 +374,7 @@ const char *get_id(const char **inout) {
bool comment(const char **pos) {
if ((*pos)[0] == '/' && (*pos)[1] == '/' && (*pos)[2] != '!') {
- *pos += 2 + strcspn(*pos, "\r\n");
+ *pos += strcspn(*pos, "\r\n");
return true;
} else {
return false;
@@ -2053,7 +2053,8 @@ PARSER(parse_func_def) {
} else if (match_word(&pos, "cached")) {
if (!cache_ast) cache_ast = NewAST(ctx->file, pos, pos, Int, .i=INT64_MAX, .bits=64);
} else if (match_word(&pos, "cache_size")) {
- if (whitespace(&pos), !match(&pos, "="))
+ whitespace(&pos);
+ if (!match(&pos, "="))
parser_err(ctx, flag_start, pos, "I expected a value for 'cache_size'");
whitespace(&pos);
cache_ast = expect(ctx, start, &pos, parse_expr, "I expected a maximum size for the cache");
@@ -2103,7 +2104,7 @@ PARSER(parse_inline_c) {
size_t line_len = strcspn(pos, "\r\n");
c_code = CORD_all(c_code, GC_strndup(pos, line_len), "\n");
pos += line_len;
- if (whitespace(&pos) == 0) break;
+ if (whitespace(&pos) == WHITESPACE_NONE) break;
}
expect_closing(ctx, &pos, open == '(' ? ")" : "}", "I wasn't able to parse the rest of this inline C");
spaces(&pos);