From 8a221325935df057c89938de69e6393c3aec62d5 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Sat, 3 May 2025 22:41:49 +0200 Subject: cook: add support for notes --- cook/parse.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'cook/parse.scm') diff --git a/cook/parse.scm b/cook/parse.scm index e162698..e53ce9f 100644 --- a/cook/parse.scm +++ b/cook/parse.scm @@ -56,6 +56,11 @@ https://github.com/cooklang/spec/blob/main/EBNF.md comment? (text comment-text)) +(define-record-type + (make-note text) + note? + (text note-text)) + (define-record-type (make-recipe metadata body) recipe? @@ -118,6 +123,11 @@ https://github.com/cooklang/spec/blob/main/EBNF.md ((: "[-" (=> c (* any)) "-]") (make-comment (list->string c)))) + (note-line ((: ">" (=> c (+ ,any-text-chars)) (or eos ,nl)) + (string-trim (list->string c)))) + (note ((=> n (+ ,note-line)) + (make-note (string-join n " ")))) + (word ((=> w (+ ,word-chars)) w)) (unit ((=> u ,(parse-map-substring @@ -189,7 +199,7 @@ https://github.com/cooklang/spec/blob/main/EBNF.md (* ,whitespace) eol) (make-metadata-line k v))) - (element ((or ,metadata ,comment ,step))) + (element ((or ,metadata ,comment ,note ,step))) (recipe ((=> els (* (: ,element ,(parse-ignore -- cgit v1.2.3