[Haskell-beginners] parser error coordinates transformation from preprocessed to original text

Stephen Tetley stephen.tetley at gmail.com
Sun Sep 18 18:56:55 CEST 2011


Hi Radoslav

Comment removal is usually done as part of lexing, so during lexing
you will have access to the true source position - if you care about
line numbering (and have a split between lexing and parsing) usually
you would annotate lexemes with their source position.

If you are doing macro-expansion before parsing and lexing, it is
common to tell the macro expander an artificial but hopefully
correct-to-the-user line number with a pragma like #line.



More information about the Beginners mailing list