Re: patch applied (ghc): Adding a GENERATED pragma

Andy Gill <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.all
Message-ID <46C9642A-93B4-4612-AB2A-57094B964702__45818.2699782357$1167414805$gmane$org@galois.com>
That is sort of correct, it is more fine grain than line, but also  
refers to an external file/name.

#LINE ==> where you are in your *haskell* source file (because  
perhaps you moved line because of #includes, etc).

#GENERATED ==> This is part of your Haskell program, but this source  
was derived (generated or quoted) from
*another source file*.
#GENERATED does not alter the internal SrcSpan's for this module in  
anyway, much like {-# SCC ... and other pragmas.

A good example is happy. The actions are actually GENERATED from the  
*.y file. The idea is that you can use Hpc to get
coverage of a *grammar*, checking that you have actually tested your  
complete parser. Reading the machine generated
Haskell is painful :-)

I'm open to other named than GENERATED. The file aspect is just a  
name, it could be a component name, the
usage is domain specific. We could also generalize, and have lines  
ranges, as well an spans.

Does this help? What do you think?

Andy

On Dec 29, 2006, at 1:02 AM, Simon Peyton-Jones wrote:

> Andy, what's this about?  GHC already understands #LINE pragmas a  
> la cpp. Is that what you wanted?  Your pragma looks more fine- 
> grained than that, I guess.
>
> Simon
>
> | -----Original Message-----
> | From: [email protected] [mailto:cvs-all- 
> [email protected]]
> | On Behalf Of Andy Gill
> | Sent: 29 December 2006 07:36
> | To: [email protected]
> | Subject: patch applied (ghc): Adding a GENERATED pragma
> |
> | Thu Dec 28 23:29:48 PST 2006  [email protected]
> |   * Adding a GENERATED pragma
> |
> |   Adding a {-# GENERATED "SourceFile" SourceSpan #-} <expr> pragma.
> |   This will be used to generate coverage for tool generated (or  
> quoted)
> | code.
> |   The pragma states the the expression was generated/quoted from the
> | stated
> |   source file and source span.
> |
> |
> |     M ./compiler/deSugar/Coverage.lhs -3 +10
> |     M ./compiler/deSugar/DsMeta.hs +1
> |     M ./compiler/hsSyn/HsExpr.lhs +6
> |     M ./compiler/parser/Lexer.x +3
> |     M ./compiler/parser/Parser.y.pp -1 +17
> |     M ./compiler/rename/RnExpr.lhs +3
> |     M ./compiler/typecheck/TcExpr.lhs +3
> |     M ./compiler/typecheck/TcHsSyn.lhs +4
> |
> | _______________________________________________
> | Cvs-ghc mailing list
> | [email protected]
> | http://www.haskell.org/mailman/listinfo/cvs-ghc
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.