7.7
Paren-shape Pattern Expanders
(require paren-shape/pattern-expander) | |
package: paren-shape |
NOTE: This library is deprecated; use the pattern expanders from syntax/parse/class/paren-shape, instead. Specifically, this reprovides ~parens, ~brackets, and ~braces, three pattern expanders that match syntax objects only when then 'paren-shape property matches the expected value.
Examples:
> (require syntax/parse syntax/parse/class/paren-shape)
> (syntax-parse #'(1 2 3) [(~parens a b c) #'a]) #<syntax:eval::2 1>
> (syntax-parse #'[1 2 3] [(~parens a b c) #'a]) eval::1-8: ?: expected list or pair surrounded by
parentheses
at: (1 2 3)
in: (1 2 3)
> (syntax-parse #'[1 2 3] [(~brackets a b c) #'a]) #<syntax:eval::2 1>
> (syntax-parse #'(1 2 3) [(~brackets a b c) #'a]) eval::1-8: ?: expected list or pair surrounded by square
brackets
at: (1 2 3)
in: (1 2 3)
> (syntax-parse #'{1 2 3} [(~braces a b c) #'a]) #<syntax:eval::2 1>
> (syntax-parse #'(1 2 3) [(~braces a b c) #'a]) eval::1-8: ?: expected list or pair surrounded by curly
braces
at: (1 2 3)
in: (1 2 3)