mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 14:49:18 +02:00
don't truncate trailing newlines before }
This commit is contained in:
parent
63c7151499
commit
0257ab38c6
1 changed files with 2 additions and 9 deletions
|
@ -232,17 +232,10 @@
|
||||||
(lp (cdr p) (cons (read-char in) ls))))))
|
(lp (cdr p) (cons (read-char in) ls))))))
|
||||||
(else (tok (cons c str) res punc (- depth 1)))))
|
(else (tok (cons c str) res punc (- depth 1)))))
|
||||||
((eqv? c #\newline)
|
((eqv? c #\newline)
|
||||||
(let* ((first? (and (null? res) (null? str)))
|
(let* ((res (collect str res))
|
||||||
;;(res (collect (drop-while char-whitespace? str) res))
|
(res (if (and (null? res) (null? str))
|
||||||
(res (collect str res))
|
|
||||||
(res (if (or first? (eqv? #\} (peek-char in)))
|
|
||||||
res
|
res
|
||||||
(cons "\n" res))))
|
(cons "\n" res))))
|
||||||
;; (let lp ((ls '()))
|
|
||||||
;; (let ((c (peek-char in)))
|
|
||||||
;; (cond
|
|
||||||
;; ((char-whitespace? c) (read-char in) (lp (cons c ls)))
|
|
||||||
;; (else (tok (if (eqv? c #\}) ls '()) res punc depth)))))
|
|
||||||
(tok '() res punc depth)))
|
(tok '() res punc depth)))
|
||||||
(else
|
(else
|
||||||
(tok (cons c str) res punc depth)))))
|
(tok (cons c str) res punc depth)))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue