From 64143f0a131a053414e4b73c17bff994522b11c2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 3 Sep 2024 13:19:41 -0400 Subject: Syntax overhaul (comments back to `#`, print statments to `!!`), using `$/.../` for patterns and using a DSL for patterns --- parse.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index 8ab3688e..36ce3ddf 100644 --- a/parse.c +++ b/parse.c @@ -378,7 +378,7 @@ const char *get_id(const char **inout) { } bool comment(const char **pos) { - if ((*pos)[0] == '/' && (*pos)[1] == '/' && (*pos)[2] != '!') { + if ((*pos)[0] == '#') { *pos += strcspn(*pos, "\r\n"); return true; } else { @@ -1194,6 +1194,9 @@ PARSER(parse_text) { open_quote = *pos; ++pos; close_quote = closing[(int)open_quote] ? closing[(int)open_quote] : open_quote; + + if (!lang && open_quote == '/') + lang = "Pattern"; } else { return NULL; } @@ -2132,7 +2135,7 @@ PARSER(parse_doctest) { PARSER(parse_say) { const char *start = pos; - if (!match(&pos, "//!")) return NULL; + if (!match(&pos, "!!")) return NULL; spaces(&pos); ast_list_t *chunks = NULL; -- cgit v1.2.3