X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/66c609241dd2783c53e6bdbf2dc80c528feaeef7..54ea6ee880f52c23279bf58262ca245b531d04b0:/src/module-parse.lisp diff --git a/src/module-parse.lisp b/src/module-parse.lisp index fb4903b..8344281 100644 --- a/src/module-parse.lisp +++ b/src/module-parse.lisp @@ -52,6 +52,7 @@ (define-pluggable-parser module code (scanner pset) ;; `code' id `:' item-name [constraints] `{' c-fragment `}' + ;; `code' id `:' constraints `;' ;; ;; constraints ::= `[' list[constraint] `]' ;; constraint ::= item-name+ @@ -80,16 +81,21 @@ (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 ((constraints (constraints)) + (nil (must #\;))) + (make-instance 'code-fragment-item + :reason reason + :constraints constraints)) + (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.