Immanuel Litzroth <immanuell@enfocus.be> writes:
thanks for your code. Perhaps I was not completely clear in my question: I specifically want to know if unliterating should include lexing so that it recognizes strings (comments) or if it can be a separate phase. The following compiles without problems in ghc.
\begin{code} main :: IO () main = putStr " \end{code} " \begin{code} " \end{code}
Ghc should not accept this code, because, no matter how the unliterating is achieved, it is illegal for a literal string to contain a literal newline character. (You must use '\n' for the character, and/or string-gaps if your intention is to make the layout more readable.)
The report says Program code ends just before a subsequent line that begins \end{code} (ignoring string literals, of course).
Certainly if the unliteration spec in the Haskell 1.2 Report is still valid (?) I believe the intention is that all unliteration is done in a line-by-line manner before any interpretation of the "code" text. Therefore, the unliteration engine does not need to lex the program code at all. Regards, Malcolm