summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-09-01 21:24:46 -0700
committerOri Bernstein <ori@eigenstate.org>2017-09-01 21:24:46 -0700
commit09600737acb8ce303be5af4b7fdf944e819b8558 (patch)
tree0c09567e87c186b42502e323f0d65af102a6110f /mbld
parent2da75521162ef1b19fb047c13c77c5dd33910671 (diff)
downloadmc-09600737acb8ce303be5af4b7fdf944e819b8558.tar.gz
Bring back quoted words.
I didn't think they were used. My mistake.
Diffstat (limited to 'mbld')
-rw-r--r--mbld/parse.myr38
1 files changed, 28 insertions, 10 deletions
diff --git a/mbld/parse.myr b/mbld/parse.myr
index dcc60e7..de8178a 100644
--- a/mbld/parse.myr
+++ b/mbld/parse.myr
@@ -638,26 +638,44 @@ const wordlist = {p
}
/* word: /wordchar*/
+/* word: /wordchar*/
const word = {p
var c, n
var start
skipspace(p)
+
c = peekc(p)
- n = 0
- start = p.rest
- while p.rest.len > 0
- c = peekc(p)
- if c == '\\'
- c = getc(p)
- ;;
- if wordchar(c)
+ if c == '"'
+ n = 0
+ getc(p)
+ start = p.rest
+ while p.rest.len > 0
+ c = peekc(p)
+ if c == '"'
+ getc(p)
+ goto done
+ elif c == '\\'
+ c = getc(p)
+ ;;
getc(p)
n += std.charlen(c)
- else
- break
+ ;;
+ failparse(p, "input ended within quoted word\n")
+ else
+ n = 0
+ start = p.rest
+ while p.rest.len > 0
+ c = peekc(p)
+ if wordchar(c)
+ getc(p)
+ n += std.charlen(c)
+ else
+ break
+ ;;
;;
;;
+:done
if n > 0
-> `std.Some std.sldup(start[:n])
else