Move chomp function into its own util file

original commit: 4d448785cd3a256dccb5b84a59170a2b4dd0b41c
This commit is contained in:
Asumu Takikawa 2014-01-06 17:47:55 -05:00
parent 7c00a7d443
commit 69df7f2664

View File

@ -6,6 +6,7 @@ don't depend on any other portion of the system
|#
(require syntax/source-syntax "disappeared-use.rkt"
"string.rkt"
racket/list racket/match racket/promise racket/string
syntax/parse (for-syntax racket/base syntax/parse)
(only-in unstable/sequence in-slice))
@ -163,13 +164,6 @@ don't depend on any other portion of the system
(apply tc-error/delayed #:stx stx final-msg (reverse vals))
(apply tc-error/stx stx final-msg (reverse vals))))
;; helper for above, remove \n at end if any
(define (chomp str)
(define len (string-length str))
(if (eq? #\newline (string-ref str (sub1 len)))
(substring str 0 (sub1 len))
str))
;; produce a type error, using the current syntax
(define (tc-error msg . rest)
(let* ([ostx (current-orig-stx)]