diff --git a/collects/syntax-color/lexer-contract.rkt b/collects/syntax-color/lexer-contract.rkt index b7bc37323d..96e266f579 100644 --- a/collects/syntax-color/lexer-contract.rkt +++ b/collects/syntax-color/lexer-contract.rkt @@ -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) diff --git a/collects/syntax-color/racket-lexer.rkt b/collects/syntax-color/racket-lexer.rkt index 38099618c8..eacb3f7ff0 100644 --- a/collects/syntax-color/racket-lexer.rkt +++ b/collects/syntax-color/racket-lexer.rkt @@ -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