racket/collects/syntax-color/lexer-contract.rkt
2013-02-23 19:50:34 -06:00

35 lines
1.3 KiB
Racket

#lang racket/base
(require racket/contract/base
unstable/options)
(provide lexer/c)
(define lexer/c
(option/c
(or/c (->i ([in input-port?])
(values [txt any/c]
[type symbol?]
[paren (or/c symbol? #f)]
[start (or/c exact-positive-integer? #f)]
[end (start)
(if start
(and/c exact-positive-integer?
(>=/c start))
#f)]))
(->i ([in input-port?]
[offset exact-nonnegative-integer?]
[mode any/c])
(values [txt any/c]
[type symbol?]
[paren (or/c symbol? #f)]
[start (or/c exact-positive-integer? #f)]
[end (start)
(if start
(and/c exact-positive-integer?
(>=/c start))
#f)]
[backup exact-nonnegative-integer?]
[new-mode any/c])))
#:tester (λ (x) (and (procedure? x)
(or (procedure-arity-includes? x 1)
(procedure-arity-includes? x 3))))))