aboutsummaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-03 13:19:41 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-03 13:19:41 -0400
commit64143f0a131a053414e4b73c17bff994522b11c2 (patch)
tree2545507fde623f8846bf183388acdbb0234b5e65 /parse.c
parent5feecff9d93522002c74a1423d138c2aa8bc150d (diff)
Syntax overhaul (comments back to `#`, print statments to `!!`),
using `$/.../` for patterns and using a DSL for patterns
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c7
1 files changed, 5 insertions, 2 deletions
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;