On 11/16/2016 06:11 PM, Dan Liebgold wrote:
Hi,

A couple questions about literals in syntax-parse:

1. I'd like to make a syntax-class that is just a set of literals
(with a clear error for something not matching any literal). Is there
a better way than this:

http://pasterack.org/pastes/86722

I need to ignore the bindings for those identifiers, and I need to
preserve the syntax context.

2. Is there any plan or easy way to implement #:datum-literal-sets
for syntax-classes?  It'd be nice to share a list of literals (with
ignored bindings) among multiple classes.

Literal sets can include datum-literals:

  (define-literal-set lits #:datum-literals (a b c) (d e))

For question 1, that's probably the best way. If you want to suppress the printing of all of the datum literals in error messages, you can mark the syntax class as `#:opaque`.

In principle, you could also use `literal-set->predicate`, but I just discovered it ignores the datum literals. I'll push a fix.

Ryan

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to