diff options
Diffstat (limited to 'cook/debug.sld')
-rw-r--r-- | cook/debug.sld | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/cook/debug.sld b/cook/debug.sld index 638c13a..c35f8f9 100644 --- a/cook/debug.sld +++ b/cook/debug.sld @@ -4,31 +4,31 @@ (srfi 9) (srfi 69) (chibi) + (chibi match) (cook parse-internals)) (begin (define (cook->list y) - (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) - (list 'cookware (cookware-name y) (cook->list (cookware-amount y)))) - ((ingredient? y) - (list 'ingredient (ingredient-name y) (cook->list (ingredient-amount y)))) - ((timer? y) - (list 'timer (timer-name y) (cook->list (timer-amount y)))) - ((metadata-line? y) - (list 'metadata-line (metadata-line-key y) (metadata-line-value y))) - ((step? y) - (list 'step (map cook->list (step-elements y)))) - ((hash-table? y) + (match y + (($ <amount> quantity unit) + (list 'amount quantity unit)) + (($ <comment> text) + (list 'comment text)) + (($ <component> name amount) + (list 'component name (cook->list amount))) + (($ <cookware> name amount) + (list 'cookware name (cook->list amount))) + (($ <ingredient> name amount) + (list 'ingredient name (cook->list amount))) + (($ <timer> name amount) + (list 'timer name (cook->list amount))) + (($ <metadata-line> key value) + (list 'metadata-line key value)) + (($ <step> elements) + (list 'step (map cook->list elements ))) + ((? hash-table? y) (list 'metadata (cook->list (hash-table->alist y)))) - ((recipe? y) - (list 'recipe (cook->list (recipe-metadata y)) - (cook->list (recipe-body y)))) - ((list? y) + (($ <recipe> metadata body) + (list 'recipe (cook->list metadata) (cook->list body))) + ((? list? y) (map cook->list y)) (else y))))) |