summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cook/debug.sld2
-rw-r--r--cook/parse-internals.sld4
-rw-r--r--cook/parse.scm12
-rw-r--r--cook/parse.sld2
4 files changed, 19 insertions, 1 deletions
diff --git a/cook/debug.sld b/cook/debug.sld
index c35f8f9..1f4f803 100644
--- a/cook/debug.sld
+++ b/cook/debug.sld
@@ -13,6 +13,8 @@
(list 'amount quantity unit))
(($ <comment> text)
(list 'comment text))
+ (($ <note> text)
+ (list 'note text))
(($ <component> name amount)
(list 'component name (cook->list amount)))
(($ <cookware> name amount)
diff --git a/cook/parse-internals.sld b/cook/parse-internals.sld
index d2099e1..01cf5c2 100644
--- a/cook/parse-internals.sld
+++ b/cook/parse-internals.sld
@@ -44,6 +44,9 @@
<comment>
comment?
comment-text
+ <note>
+ note?
+ note-text
;; Functions
parse-cook
nl
@@ -51,6 +54,7 @@
any-text-item
text-item
comment
+ note
word
unit
quantity
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
diff --git a/cook/parse.sld b/cook/parse.sld
index 1af9734..17ae1b6 100644
--- a/cook/parse.sld
+++ b/cook/parse.sld
@@ -24,6 +24,8 @@
cookware-amount
comment?
comment-text
+ note?
+ note-text
step?
step-elements
recipe?