EPA : End of file marker
The exact print annotations are used to capture exactly what was in an input source file. This means the end of file location needs to be tracked too.
At the moment, this is done by injecting a "comment" with the constructor EpaEofComment
as part of the final processing of the module
production in the parser.
There are two problems with this.
-
This information should more properly be captured in the
RealSrcSpan
associated with theHsModule
. This gets set to a point span for location (1,1) viafileSrcSpan
. I think this happens because when parsing the header only the whole file is not processed. But formodule
the whole file is processed, so there is no reason not to capture the full span here. -
The lexer does not actually capture this information (
eof-pos
inPState
) correctly, as when it hits the actual end of file it immediately stops processing, without recording the information. This is complicated if there are actual comments or blank lines after the last token captured in themodule
production.