@Section
@Title { Error messages }
@Tag { cpp_erro }
@Begin
@PP
In order to understand the error messages produced by program
printing, it is necessary to understand that Lout's first step when
given a program text is to pass it to the separate {@Code prg2lout}
program for analysis. This separate program is the source of most
of the error messages associated with program printing.
@PP
The {@Code prg2lout} program is quite happy to format a fragment of a
computer program: there is no need to supply a complete routine, or
a complete statement, or any such thing. However, it will complain if
you supply only a fragment of one lexical unit, such as a comment or
string without its terminating delimiter. It will also complain if
there is a character that cannot be classified as part of an identifier,
number, etc. according to the rules of the language as they have been
given to @Code prg2lout by the implementer. Irrespective of the
language rules, @Code prg2lout always interprets spaces, tabs, newlines,
and formfeed characters in the usual way.
@PP
If an error message is generated by {@Code prg2lout}, it will contain
a line and column number counting from the start of the program text
involved. Lout will precede this error message with a file name,
line number, and column number pointing to the Lout symbol
({@Code "@CP"}, {@Code "@Eiffel"} etc.) whose program text caused the
error message, like this:
@ID @Code @Verbatim {
lout file "cpp_tabs" (from "cpp" line 80, from "all" line 45):
56,23: prg2lout 2,1: program text ended within comment
}
This is an actual message produced when formatting this chapter. The
program text in question has only one line, containing an incomplete comment,
so when @Code "prg2lout" tried to start the second line and found nothing,
it complained as shown. In general, then, you have to add
{@Code "prg2lout"}'s line number to Lout's line number, and use some
initiative, to find the precise point of the problem.
@End @Section