; Copyright (c) 1993-2008 by Richard Kelsey and Jonathan Rees. See file COPYING.

; Vanilla package reader

(define (vanilla-read-forms package filename port mode)
  (if (eq? mode 'script)
      (skip-line port))
  (if (eq? mode 'datum)
      (read port)
      (let loop ((forms '()))
	(let ((form (read port)))
	  (if (eof-object? form)
	      (reverse forms)
	      (loop (cons (in-package-context package 0 form) forms)))))))

(define (skip-line port)
  (let loop ()
    (let ((char (read-char port)))
      (if (and (not (eof-object? char))
	       (not (char=? #\newline char)))
	  (loop)))))