Skip to content

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.

  1. This information should more properly be captured in the RealSrcSpan associated with the HsModule. This gets set to a point span for location (1,1) via fileSrcSpan. I think this happens because when parsing the header only the whole file is not processed. But for module the whole file is processed, so there is no reason not to capture the full span here.

  2. The lexer does not actually capture this information (eof-pos in PState) 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 the module production.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information