You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
633 B
Racket
17 lines
633 B
Racket
9 years ago
|
#lang racket/base
|
||
|
|
||
|
(module reader racket/base
|
||
|
(require racket/port syntax/strip-context)
|
||
|
(provide (rename-out [pattern-prep-read read]
|
||
|
[pattern-prep-read-syntax read-syntax]))
|
||
|
|
||
|
(define (pattern-prep-read in)
|
||
|
(syntax->datum (pattern-prep-read-syntax #f in)))
|
||
|
|
||
|
(define (pattern-prep-read-syntax src in)
|
||
|
(with-syntax ([str (port->string in)])
|
||
|
(strip-context
|
||
|
#'(module pattern-prep racket/base
|
||
|
(require hyphenate/core racket/list racket/string)
|
||
|
(provide patterns)
|
||
|
(define patterns (apply hash (append-map string->hashpair (string-split str)))))))))
|