Skip to content

Commit

Permalink
added fix so interactive call to (readline) does not see immediate le…
Browse files Browse the repository at this point in the history
…ading newline
  • Loading branch information
mroll committed Apr 17, 2016
1 parent e2b0367 commit 421c700
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ac.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,15 @@ Arc 3.1 documentation: https://arclanguage.github.io/ref.
"))
(tl2 interactive?)))

(define (trash-whitespace)
(if (char-ready?)
(let ((c (peek-char)))
(if (or (not (char-whitespace? c))
(equal? c #\newline))
'()
(begin (read-char)
(trash-whitespace))))))

(define (tl2 interactive?)
(when interactive? (display "arc> "))
(on-err (lambda (c)
Expand All @@ -1251,6 +1260,7 @@ Arc 3.1 documentation: https://arclanguage.github.io/ref.
(tl2 interactive?))
(lambda ()
(let ((expr (read)))
(trash-whitespace) ; throw away until we hit non-white or leading newline
(if (eof-object? expr)
(begin (when interactive? (newline))
(exit)))
Expand Down

0 comments on commit 421c700

Please sign in to comment.