<code-definition> ::=
"code" <reason> ":" <item-name> @[<constraints>@]
"{" <c-fragment> "}"
+\alt
+ "code" <reason> ":" <constraints> ";"
<reason> ::= <identifier>
(when (eq reason (code-fragment-reason frag))
(dolist (constraint (code-fragment-constraints frag))
(add-sequencer-constraint sequencer constraint))
- (add-sequencer-item-function sequencer (code-fragment-name frag)
- (lambda (stream)
- (write (code-fragment frag)
- :stream stream
- :pretty nil
- :escape nil)))))
+ (awhen (code-fragment-name frag)
+ (add-sequencer-item-function sequencer it
+ (lambda (stream)
+ (write (code-fragment frag)
+ :stream stream
+ :pretty nil
+ :escape nil))))))
(defmethod hook-output progn ((module module) (reason (eql :h)) sequencer)
(sequence-output (stream sequencer)
(define-pluggable-parser module code (scanner pset)
;; `code' id `:' item-name [constraints] `{' c-fragment `}'
+ ;; `code' id `:' constraints `;'
;;
;; constraints ::= `[' list[constraint] `]'
;; constraint ::= item-name+
(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