Changes between Version 10 and Version 11 of HaddockComments


Ignore:
Timestamp:
Oct 21, 2006 9:48:44 PM (9 years ago)
Author:
waern
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HaddockComments

    v10 v11  
    99 
    1010= Lexer details = 
     11In the lexer, a doc comment is recognized as a token. Without the -haddock flag, the lexer won't recognize the doc tokens, and this is what effectively turns off the entire extension. 
     12 
    1113{{{ 
    1214data Token = 
     
    1921  | ITdocOptions      String     -- doc options (prune, ignore-exports, etc) 
    2022}}}  
    21 In the lexer, doc comments are recognized as tokens. There are four types of doc comments at this level, each having its own token. Each token contains the entire comment string.  
    22  
     23There are four types of doc comments at this level, each having its own token. Each token contains the entire comment string.  
    2324Just like the old Haddock, we support "next" and "previous"-type comments, "named" comments and section headings. The options token is used for   specifiying Haddock options. Options are specified using a pragma, like this: {-# DOCOPTIONS prune, ignore-exports }. You can no longer specify them using dash comments (e.g -- # prune). 
    2425 
     
    2728 
    2829When a doc token is encountered by the parser, it tries to parse the content of the token. This is done by invoking a special Alex lexer ([[GhcFile(compiler/parser/HaddockLex.x)]]) and Happy parser ([[GhcFile(compiler/parser/HaddockParse.y)]]), taken directly from the old Haddock sources. This process turns the token into a value of type {{{HsDoc RdrName}}}, representing the (internal structure of the) comment. It can then be stored in the Haskell AST by the parser at the appropriate place. A lot of places (constructors) in the AST definition ([[GhcFile(compiler/hsSyn)]]) allow {{{HsDoc}}}s, and more can be added. 
    29  
    30 A doc token at a place where the parser doesn't expect it will result in a parse error. 
    3130 
    3231= Binding groups =