diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-08-11 00:31:17 +0200 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-08-11 00:31:17 +0200 |
commit | b6e934250c4b7b74201984f74392a2ce510e055d (patch) | |
tree | 2256aa5b8d90d122f8a52aa9d3b4a94973d69355 /cook | |
parent | ecafa5d239474fb6cfde84c3fe5a1267cd3d0bbb (diff) |
Also mark comments
Diffstat (limited to 'cook')
-rw-r--r-- | cook/debug.sld | 2 | ||||
-rw-r--r-- | cook/parse-internals.sld | 2 | ||||
-rw-r--r-- | cook/parse.scm | 9 | ||||
-rw-r--r-- | cook/parse.sld | 2 |
4 files changed, 13 insertions, 2 deletions
diff --git a/cook/debug.sld b/cook/debug.sld index 9ae9638..6b7ef33 100644 --- a/cook/debug.sld +++ b/cook/debug.sld @@ -10,6 +10,8 @@ (cond ((amount? y) (list 'amount (amount-quantity y) (amount-unit y))) + ((comment? y) + (list 'comment (comment-text y))) ((component? y) (list 'component (component-name y) (cook->list (component-amount y)))) ((cookware? y) diff --git a/cook/parse-internals.sld b/cook/parse-internals.sld index 5b8df2e..99160fd 100644 --- a/cook/parse-internals.sld +++ b/cook/parse-internals.sld @@ -28,6 +28,8 @@ metadata-line-value step? step-elements + comment? + comment-text parse-cook nl whitespace diff --git a/cook/parse.scm b/cook/parse.scm index 33bf3b0..2cc604b 100644 --- a/cook/parse.scm +++ b/cook/parse.scm @@ -51,6 +51,11 @@ https://github.com/cooklang/spec/blob/main/EBNF.md step? (elements step-elements)) +(define-record-type <comment> + (make-comment text) + comment? + (text comment-text)) + (define (metadata-line-list->hash-table meta-lines) (let ((metadata (make-hash-table))) (for-each (lambda (line) @@ -86,9 +91,9 @@ https://github.com/cooklang/spec/blob/main/EBNF.md (list->string c))) (comment ((: "--" (=> c (+ ,any-text-chars)) ,nl) - (list->string c)) + (make-comment (list->string c))) ((: "[-" (=> c (* any)) "-]") - (list->string c))) + (make-comment (list->string c)))) (word ((=> w (+ ,word-chars)) (list->string w))) diff --git a/cook/parse.sld b/cook/parse.sld index 29742b0..6a92d1d 100644 --- a/cook/parse.sld +++ b/cook/parse.sld @@ -20,6 +20,8 @@ cookware? cookware-name cookware-amount + comment? + comment-text step? step-elements parse-cook) |