When run it yields 'ok.
If I change it to this, it fails and I don't understand why:
(define (parser2 stx)
(syntax-parse stx
[(parser2 ((~alt (~once (~seq #:a x) #:name "#:a keyword")
(~optional (~seq #:b y) #:name "#:b keyword")
(~seq #:c z)) ...))
#''ok]))
(parser2 (#:a 1))
This yields:
[...source location...] #%datum: keyword misused as an expression
; at: #:a
I can see that (#:a 1) is not valid under the default parser since #:a is not valid for initial position but shouldn't the entire parenthesized expression be given to the macro processor and then replaced with something valid before being rejected?