summaryrefslogtreecommitdiff
path: root/cook/parse.scm
diff options
context:
space:
mode:
Diffstat (limited to 'cook/parse.scm')
-rw-r--r--cook/parse.scm21
1 files changed, 13 insertions, 8 deletions
diff --git a/cook/parse.scm b/cook/parse.scm
index 2071fdd..46313b0 100644
--- a/cook/parse.scm
+++ b/cook/parse.scm
@@ -122,11 +122,15 @@ https://github.com/cooklang/spec/blob/main/EBNF.md
(make-comment (list->string c))))
(word ((=> w (+ ,word-chars))
- (list->string w)))
- (unit ((=> u (+ ,unit-chars))
- (list->string u)))
- (quantity ((=> q (+ ,quantity-chars))
- (string->number (list->string q))))
+ w))
+ (unit ((=> u ,(parse-map-substring
+ (parse-repeat+ (parse-char unit-chars))
+ string-trim))
+ u))
+ (quantity ((=> q ,(parse-map-substring
+ (parse-repeat+ (parse-char quantity-chars))
+ string-trim))
+ (or (string->number q) q)))
(meta-key ((=> k (+ ,metadata-chars))
(list->string k)))
@@ -179,10 +183,11 @@ https://github.com/cooklang/spec/blob/main/EBNF.md
(concatenate! x))))))
(make-step (merge-step-strings (concatenate! s)))))
- (metadata ((: bol ">>" (* ,whitespace)
- (=> k ,meta-key)
+ (metadata ((: bol ">>"
+ (=> k ,(parse-map meta-key string-trim))
(* ,whitespace) ":" (* ,whitespace)
- (=> v ,any-text-item) (* ,whitespace) eol)
+ (=> v ,(parse-map any-text-item string-trim))
+ (* ,whitespace) eol)
(make-metadata-line k v)))
(element ((or ,metadata ,comment ,step)))