|
ANSI Common Lisp 23 Reader 23.1 Reader Concepts 23.1.3 Argument Conventions of Some Reader Functions
23.1.3.1 The EOF-ERROR-P argument
Eof-error-p in input function calls
controls what happens if input is from a file (or any other
input source that has a definite end) and the end of the file is reached.
If eof-error-p is true (the default),
an error of type end-of-file is signaled
at end of file. If it is false, then no error is signaled, and instead
the function returns eof-value.
Functions such as read that read the representation
of an object rather than a single
character always signals an error, regardless of eof-error-p, if
the file ends in the middle of an object representation.
For example, if a file does
not contain enough right parentheses to balance the left parentheses in
it, read signals an error. If a file ends in a
symbol or a number
immediately followed by end-of-file, read reads the
symbol or
number
successfully and when called again will
act according to eof-error-p.
Similarly, the function read-line
successfully reads the last line of a file even if that line
is terminated by end-of-file rather than the newline character.
Ignorable text, such as lines containing only whitespace2 or comments,
are not considered to begin an object;
if read begins to read an expression but sees only such
ignorable text, it does not consider the file to end in the middle of an object.
Thus an eof-error-p argument controls what happens
when the file ends between objects.
|