Andy Gill wrote:
You have two files.
012345678901234567890123456789
Happy.y:
foo ::= foo bar { BarBaz $1 $2 }
Happy.hs: (generated file)
[stuff]
rhs dollar_1 dollar_2 = BarBaz dollar_1 dollar_2
[more stuff]
Now we still want any error messages in the BarBaz code fragment to be
in terms of the generated file,
and we still want to do coverage in terms of the generated file. After
all, it is a Haskell module.
However, if we change Happy to generate the following:
Happy.hs: (generated file)
[stuff]
rhs dollar_1 dollar_2 = {-# GENERATED "Happy.y" 1:15-1:25 #-} BarBaz
dollar_1 dollar_2
[more stuff]
Under the semantics for GENERATED, this makes no difference to the
generated code,
or any error messages (say BarBaz is a typo, for example). However, Hpc
can use the pragma,
and generate a coverage markup file for *both* Happy.hs (the real
Haskell) and Happy.y,
where the GENERATED code is tied back to its original location.
Note that this is different than LINE, because LINE changes what the
current span is for
the purposes of tagging the AST, and therefore error messages (and code
coverage).
After all, the GENERATED code is even of different length than the
original production code inside {}.
I'm beginning to understand, but this still seems a bit strange.
So GENERATED is only used for coverage information? It really isn't a
generalised LINE pragma, because it doesn't affect the locations reported in
error messages. I understand that this is intentional, but... hmmmm.
Cheers,
Simon
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc