diff options
Diffstat (limited to 'cook')
-rw-r--r-- | cook/parse.scm | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/cook/parse.scm b/cook/parse.scm index 05b3a2a..098b866 100644 --- a/cook/parse.scm +++ b/cook/parse.scm @@ -89,7 +89,6 @@ https://github.com/cooklang/spec/blob/main/EBNF.md (define-grammar cook (nl ((: ,newline-chars))) - (empty-line ((: bol (* ,whitespace-chars) ,nl))) (whitespace ((=> x (+ ,whitespace-chars)) (list->string x))) @@ -147,6 +146,8 @@ https://github.com/cooklang/spec/blob/main/EBNF.md (concatenate s))) (step ((: (=> s ,step-line) (=> ns (* ,step-line))) + ;; TODO It's not converting the end of the step-line to a + ;; space (make-step (concatenate (append (list s) ns))))) (metadata ((: bol ">>" (* ,whitespace) @@ -155,12 +156,14 @@ https://github.com/cooklang/spec/blob/main/EBNF.md (=> v ,any-text-item) (* ,whitespace) eol) (make-metadata-line k v))) - (recipe ((* (or (: (=> m (+ ,metadata)) ,nl) - (=> c (+ ,comment)) - (: (=> s (+ ,step)) (or eos (* ,empty-line))))) - (list 'recipe - (metadata-line-list->hash-table (or m '())) - s)))) + (element ((or ,metadata ,comment ,step))) + + (recipe ((=> els + (* (: ,element ,(parse-ignore + (parse-seq + (parse-repeat nl) + (parse-optional parse-end)))))) + (concatenate els)))) (define (parse-cook str) (parse-fully recipe str)) |