summaryrefslogtreecommitdiff
path: root/cook/parse.scm
diff options
context:
space:
mode:
Diffstat (limited to 'cook/parse.scm')
-rw-r--r--cook/parse.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/cook/parse.scm b/cook/parse.scm
index e53ce9f..498b055 100644
--- a/cook/parse.scm
+++ b/cook/parse.scm
@@ -61,6 +61,11 @@ https://github.com/cooklang/spec/blob/main/EBNF.md
note?
(text note-text))
+(define-record-type <section>
+ (make-section name)
+ section?
+ (name section-name))
+
(define-record-type <recipe>
(make-recipe metadata body)
recipe?
@@ -192,6 +197,12 @@ https://github.com/cooklang/spec/blob/main/EBNF.md
(concatenate! x))))))
(make-step (merge-step-strings (concatenate! s)))))
+ (section ((: "=" (=> c (+ ,any-text-chars)) (or eos ,nl))
+ (make-section (string-trim (list->string c)
+ (lambda (x)
+ (or (char=? x #\space)
+ (char=? x #\=)))))))
+
(metadata ((: bol ">>"
(=> k ,(parse-map meta-key string-trim))
(* ,whitespace) ":" (* ,whitespace)
@@ -199,7 +210,7 @@ https://github.com/cooklang/spec/blob/main/EBNF.md
(* ,whitespace) eol)
(make-metadata-line k v)))
- (element ((or ,metadata ,comment ,note ,step)))
+ (element ((or ,metadata ,comment ,note ,section ,step)))
(recipe ((=> els
(* (: ,element ,(parse-ignore