Do not match on substrings

This commit is contained in:
Devine Lu Linvega 2024-04-25 22:35:15 -07:00
parent 7e9eab04fc
commit 2f9f9d7f15
4 changed files with 7 additions and 4 deletions

View File

@ -1,8 +1,8 @@
?(?-) (This is a fully functional Modal REPL.)
<> quit EOF
<> wait?~ (?~ wait!)
<> (?: print) ?:
<> (wait ?~) (?~ wait stdin)
<> (EOF wait stdin) (Bye.\n print)
<> (EOF wait!) (Bye.\n print)
(Say something, or type "quit":\n) print wait stdin
(Say something, or type "quit":\n) print wait!

View File

@ -52,6 +52,7 @@
connect foo bar baz = foo-barbaz (substring 1) test
prefix-anything = anything-suffix (substring 2) test
?(foo QQQ) foobar = foobar (substring 3) test
?(?-) (Lambdas)

View File

@ -8,7 +8,7 @@ all: dest
dest:
@ mkdir -p bin
run: all bin/modal
@ bin/modal -q examples/hello.modal
@ bin/modal examples/hello.modal
debug: all bin/modal-debug
@ bin/modal-debug examples/hello.modal
test: all bin/modal-debug bin/modal

View File

@ -131,6 +131,8 @@ apply_rule(Rule *r, char *s)
}
if(c != *s++) return 0;
}
c = *s;
if(!spacer(c)) return 0;
/* phase: write rule */
while((c = *b++)) {
if(c == '?') {