next up previous contents
Next: 4.4.7 Error Message Parameterization Up: 4.4 Interpreting Error Messages Previous: 4.4.5 Errors During Macroexpansion

4.4.6 Read Errors

 

The compiler also handles errors while reading the source. For example:

Error: Read error at 2:
 "(,/tex2html_wrap18423foo)"
Error in function LISP::COMMA-MACRO.
Comma not inside a backquote.
The ``at 2'' refers to the character position in the source file at which the error was signalled, which is generally immediately after the erroneous text. The next line, ``(,/tex2html_wrap18423foo)'', is the line in the source that contains the error file position. The ``/tex2html_wrap18423 '' indicates the error position within that line (in this example, immediately after the offending comma.)

When in Hemlock (or any other EMACS-like editor), you can go to a character position with:

M-< C-u position C-f
Note that if the source is from a Hemlock buffer, then the position is relative to the start of the compiled region or defun, not the file or buffer start.

After printing a read error message, the compiler attempts to recover from the error by backing up to the start of the enclosing top-level form and reading again with *read-suppress* true. If the compiler can recover from the error, then it substitutes a call to cerror for the unreadable form and proceeds to compile the rest of the file normally.

If there is a read error when the file position is at the end of the file (i.e., an unexpected EOF error), then the error message looks like this:

Error: Read error in form starting at 14:
 "(defun test ()"
Error in function LISP::FLUSH-WHITESPACE.
EOF while reading #<Stream for file "/usr/me/test.lisp">
In this case, ``starting at 14'' indicates the character position at which the compiler started reading, i.e. the position before the start of the form that was missing the closing delimiter. The line "(defun test ()" is first line after the starting position that the compiler thinks might contain the unmatched open delimiter.


next up previous contents
Next: 4.4.7 Error Message Parameterization Up: 4.4 Interpreting Error Messages Previous: 4.4.5 Errors During Macroexpansion

Raymond Toy
Mon Jul 14 09:11:27 EDT 1997