chiark / gitweb /
src/module-parse.lisp (code): Allow setting constraints without a fragment.
[sod] / src / module-parse.lisp
index f025e379a8a7f718637e27ab285a3af71384cff8..83442818780b2d99d7a127fae9f69bf6d0772135 100644 (file)
@@ -52,6 +52,7 @@ (define-pluggable-parser module typename (scanner pset)
 
 (define-pluggable-parser module code (scanner pset)
   ;; `code' id `:' item-name [constraints] `{' c-fragment `}'
+  ;; `code' id `:' constraints `;'
   ;;
   ;; constraints ::= `[' list[constraint] `]'
   ;; constraint ::= item-name+
@@ -80,7 +81,12 @@ (define-pluggable-parser module code (scanner pset)
       (parse (seq ("code"
                   (reason (must (kw)))
                   (nil (must #\:))
-                  (item (or (seq ((name (must (item)))
+                  (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