diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2025-05-03 22:41:49 +0200 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2025-05-03 22:41:49 +0200 |
commit | 8a221325935df057c89938de69e6393c3aec62d5 (patch) | |
tree | d67315ee23f130d647fd60f7685f02b5c9f17321 /cook/parse.scm | |
parent | 9eb062d7c2abf9a67000ea5dc63a28facd655365 (diff) |
cook: add support for notes
Diffstat (limited to 'cook/parse.scm')
-rw-r--r-- | cook/parse.scm | 12 |
1 files changed, 11 insertions, 1 deletions
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 <note> + (make-note text) + note? + (text note-text)) + (define-record-type <recipe> (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 |