From: Mark Wooding Date: Thu, 22 Aug 2019 12:00:18 +0000 (+0100) Subject: src/module-parse.lisp (code): Prepare for an additional variant. X-Git-Url: https://git.distorted.org.uk/~mdw/sod/commitdiff_plain/d018d6d87c7a2c3458348f775319b6f9c4a88380?hp=66c609241dd2783c53e6bdbf2dc80c528feaeef7 src/module-parse.lisp (code): Prepare for an additional variant. Some more minor refactoring: pull NAME [CONSTRAINTS] `{' FRAGMENT `}' into an `or' subitem. --- diff --git a/src/module-parse.lisp b/src/module-parse.lisp index fb4903b..f025e37 100644 --- a/src/module-parse.lisp +++ b/src/module-parse.lisp @@ -80,16 +80,16 @@ (parse (seq ("code" (reason (must (kw))) (nil (must #\:)) - (name (must (item))) - (constraints (? (constraints))) - (fragment (fragment))) - (when name - (add-to-module *module* - (make-instance 'code-fragment-item - :fragment fragment - :constraints constraints - :reason reason - :name name)))))))) + (item (or (seq ((name (must (item))) + (constraints (? (constraints))) + (fragment (fragment))) + (and name + (make-instance 'code-fragment-item + :reason reason + :constraints constraints + :name name + :fragment fragment)))))) + (when item (add-to-module *module* item))))))) ;;; External files.