> (prefix 6 5 4) raises the same error as before, and the definition of
> prefix/parse complains "syntax-parse: duplicate attribute in: tail".
This is because ~or behaves differently under ellipses, and nested ~or are just
inlined. Your code for prefix/parse is therefore equivalent to (~or alt1
Thanks! Is there an equivalent approach that works to replace ~optional as
a repetition constraint? Given:
(define-syntax (prefix stx)
> (syntax-parse stx
> [(_ (~or (~seq nat:exact-nonnegative-integer)
> (~optional (~seq #:tail tail)
> #:defaults ([tail
> On Mar 20, 2017, at 11:04 AM, Philip McGrath wrote:
>
> Using expr/c to attach a contract to a macro sub-pattern doesn't seem to work
> with ~optional, even when the attribute is bound with #:defaults.
>
> For example, this program:
> #lang racket
> (require (for-syntax syntax/parse))
> (de
Using expr/c to attach a contract to a macro sub-pattern doesn't seem to
work with ~optional, even when the attribute is bound with #:defaults.
For example, this program:
> #lang racket
(require (for-syntax syntax/parse))
> (define-syntax (example stx)
> (syntax-parse stx
> [(_ (~optional
4 matches
Mail list logo