fix lexer contract

This commit is contained in:
Robby Findler 2013-02-26 08:47:59 -06:00
parent 478ec22d02
commit 3c295d14d0
2 changed files with 15 additions and 13 deletions

View File

@ -3,6 +3,16 @@
unstable/options)
(provide lexer/c)
(define (end/c start type)
(cond
[(equal? 'eof type)
(or/c exact-positive-integer? #f)]
[start
(and/c exact-positive-integer?
(>/c start))]
[else
#f]))
(define lexer/c
(option/c
(or/c (->i ([in (and/c input-port? port-counts-lines?)])
@ -10,11 +20,7 @@
[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)]))
[end (start type) (end/c start type)]))
(->i ([in (and/c input-port? port-counts-lines?)]
[offset exact-nonnegative-integer?]
[mode any/c])
@ -22,11 +28,7 @@
[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)]
[end (start type) (end/c start type)]
[backup exact-nonnegative-integer?]
[new-mode any/c])))
#:tester (λ (x) (and (procedure? x)

View File

@ -7,9 +7,9 @@
(provide
(contract-out
[racket-lexer lexer/c]
[racket-lexer/status lexer/c]
[racket-nobar-lexer/status lexer/c]))
[racket-lexer lexer/c])
racket-lexer/status
racket-nobar-lexer/status)
(define-lex-abbrevs