ref: 09600737acb8ce303be5af4b7fdf944e819b8558
parent: 2da75521162ef1b19fb047c13c77c5dd33910671
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Sep 1 17:24:46 EDT 2017
Bring back quoted words. I didn't think they were used. My mistake.
--- a/mbld/parse.myr
+++ b/mbld/parse.myr
@@ -638,26 +638,44 @@
}
/* 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