remove redundant cond

This commit is contained in:
Robby Findler 2016-07-14 21:31:08 -05:00
parent 13c969528e
commit 6c95c7a142

View File

@ -231,46 +231,43 @@ todo:
[else [else
;; drop replace specials with spaces ;; drop replace specials with spaces
(cons #\space (loop (- n 1)))])])))) (cons #\space (loop (- n 1)))])]))))
(cond
[else ;; pull the newline out of peek-port2
(for ([x (in-range (string-length eol-string))]) (read-char-or-special peek-port2))
;; pull the newline out of peek-port2 (define before-token (list (pull-chars error-pos)
(for ([x (in-range (string-length eol-string))]) (read-char-or-special peek-port2)) 'no-color
#f
(define before-token (list (pull-chars error-pos) (+ base-position 1)
'no-color (+ base-position 1 error-pos)))
#f (define end-of-table-approx
(+ base-position 1) (let ([peek-port3 (peeking-input-port peek-port2)])
(+ base-position 1 error-pos))) (port-count-lines! peek-port3)
(define end-of-table-approx (define (read-line/check-double-barred)
(let ([peek-port3 (peeking-input-port peek-port2)]) (let loop ([found-double-barred? #f])
(port-count-lines! peek-port3) (define c (read-char-or-special peek-port3))
(define (read-line/check-double-barred) (cond
(let loop ([found-double-barred? #f]) [(or (equal? c #\n) (eof-object? c))
(define c (read-char-or-special peek-port3)) found-double-barred?]
(cond [else (loop (or found-double-barred?
[(or (equal? c #\n) (eof-object? c)) (member c double-barred-chars)))])))
found-double-barred?] (let loop ()
[else (loop (or found-double-barred? (define found-double-barred? (read-line/check-double-barred))
(member c double-barred-chars)))]))) (cond
(let loop () [found-double-barred?
(define found-double-barred? (read-line/check-double-barred)) (loop)]
(cond [else
[found-double-barred? (define-values (line col pos) (port-next-location peek-port3))
(loop)] pos]))))
[else (define after-token
(define-values (line col pos) (port-next-location peek-port3)) (list (pull-chars (- end-of-table-approx 1))
pos])))) 'error
(define after-token #f
(list (pull-chars (- end-of-table-approx 1)) (+ base-position 1 error-pos)
'error (+ base-position 1 error-pos end-of-table-approx -1)))
#f (if (zero? error-pos)
(+ base-position 1 error-pos) (list newline-token after-token)
(+ base-position 1 error-pos end-of-table-approx -1))) (list newline-token before-token after-token))]
(if (zero? error-pos)
(list newline-token after-token)
(list newline-token before-token after-token))])]
[else [else
(define lhses (close-cell-graph cell-connections (define lhses (close-cell-graph cell-connections