Asumu found a solution that works reasonably well:
(define-splicing-syntax-class (maybe-clause expected-clause-name
default-value)
#:attributes (ast)
(pattern (clause-name elements ...)
#:when (eq? (syntax-e #'clause-name) (syntax-e
expected-clause-name))
#:attr ast #'(cl
Is there a way to abstract datum literals out of a (splicing) syntax class?
I have a number of patterns that look something like this:
(~optional (clause-name: element ...))
and I'd like to factor that out into a common syntax class, but be able to
specialize it according to the specific clause n
2 matches
Mail list logo