The form parser established above was specifically for
parameterdef
forms. However if you have other definers of similar syntax - in this example, definers for which the name is the second subform - then you can define a form parser which can be associated with each of them, as follows:
(dspec:define-form-parser (name-second (:anonymous t))
(value name)
`(,name-second ,name))
Note that the
name-second
variable is evaluated in the body of the parser. Supposing you have another defining macro
constantdef
:
(defmacro constantdef (value name)
`(defconstant ,name ,value))
then you can associate the same parser with both this and
parameterdef
:
(dspec:define-form-parser (parameterdef
(:parser name-second-form-parser)))
(dspec:define-form-parser (constantdef
(:parser name-second-form-parser)))