From 4ebc2d7b6ea132071ff892eaa46028f5a1bd8840 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Sun, 11 Aug 2024 21:07:06 +0200 Subject: Make comments work, but break other things --- cook/parse.scm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'cook') diff --git a/cook/parse.scm b/cook/parse.scm index 2570f61..05b3a2a 100644 --- a/cook/parse.scm +++ b/cook/parse.scm @@ -95,10 +95,8 @@ https://github.com/cooklang/spec/blob/main/EBNF.md (any-text-item ((: (=> c (+ ,any-text-chars))) (list->string c))) - (text-item ((: (=> c (+ ,text-chars))) - (list->string c))) - (comment ((: "--" (=> c (+ ,any-text-chars)) ,nl) + (comment ((: "--" (=> c (+ ,any-text-chars)) (or eos ,nl)) (make-comment (list->string c))) ((: "[-" (=> c (* any)) "-]") (make-comment (list->string c)))) @@ -136,13 +134,17 @@ https://github.com/cooklang/spec/blob/main/EBNF.md (ingredient ((: "@" (=> c ,component)) (component->ingredient c))) + (text-item ((=> t (+ (or ,comment + ,ingredient + ,cookware + ,timer + ,any-text-chars))) + t)) + (step-line ((: (? ,whitespace) - (=> s (+ (or ,ingredient - ,cookware - ,timer - ,text-item))) + (=> s (+ ,text-item)) (? ,nl)) - s)) + (concatenate s))) (step ((: (=> s ,step-line) (=> ns (* ,step-line))) (make-step (concatenate (append (list s) ns))))) -- cgit v1.2.3