diff options
author | simonmar <unknown> | 2004-08-09 11:55:07 +0000 |
---|---|---|
committer | simonmar <unknown> | 2004-08-09 11:55:07 +0000 |
commit | af7f8c0379dc19ee831e25b64c9e94e733f331be (patch) | |
tree | 61060c13326cbd1055272acd1030a28f8c97c14b /src/HsParser.ly | |
parent | 97c3579a60e07866c9efaaa11d4b915424a43868 (diff) |
[haddock @ 2004-08-09 11:55:05 by simonmar]
Add support for a short description for each module, which is included
in the contents.
The short description should be given in a "Description: " field of
the header. Included in this patch are changes that make the format
of the header a little more flexible. From the comments:
-- all fields in the header are optional and have the form
--
-- [spaces1][field name][spaces] ":"
-- [text]"\n" ([spaces2][space][text]"\n" | [spaces]"\n")*
-- where each [spaces2] should have [spaces1] as a prefix.
--
-- Thus for the key "Description",
--
-- > Description : this is a
-- > rather long
-- >
-- > description
-- >
-- > The module comment starts here
--
-- the value will be "this is a .. description" and the rest will begin
-- at "The module comment".
The header fields must be in the following order: Module, Description,
Copyright, License, Maintainer, Stability, Portability.
Patches submitted by: George Russell <ger@informatik.uni-bremen.de>,
with a few small changes be me, mostly to merge with other recent
changes.
ToDo: document the module header.
Diffstat (limited to 'src/HsParser.ly')
-rw-r--r-- | src/HsParser.ly | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/HsParser.ly b/src/HsParser.ly index 5ac3e4bc..21561e0a 100644 --- a/src/HsParser.ly +++ b/src/HsParser.ly @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- -$Id: HsParser.ly,v 1.20 2004/04/20 13:08:04 simonmar Exp $ +$Id: HsParser.ly,v 1.21 2004/08/09 11:55:07 simonmar Exp $ (c) Simon Marlow, Sven Panne 1997-2002 @@ -155,14 +155,14 @@ Module Header > opts info doc } } > | body > { HsModule main_mod Nothing (reverse (fst $1)) (snd $1) -> Nothing Nothing Nothing } +> Nothing emptyModuleInfo Nothing } -> optdoc :: { (Maybe String, Maybe ModuleInfo, Maybe Doc) } +> optdoc :: { (Maybe String,ModuleInfo,Maybe Doc) } > : moduleheader { (Nothing, fst $1, snd $1) } -> | DOCOPTIONS { (Just $1, Nothing, Nothing) } +> | DOCOPTIONS { (Just $1, emptyModuleInfo,Nothing) } > | DOCOPTIONS moduleheader { (Just $1, fst $2, snd $2) } > | moduleheader DOCOPTIONS { (Just $2, fst $1, snd $1) } -> | {- empty -} { (Nothing, Nothing, Nothing) } +> | {- empty -} { (Nothing, emptyModuleInfo,Nothing) } > body :: { ([HsImportDecl],[HsDecl]) } > : '{' bodyaux '}' { $2 } @@ -1007,11 +1007,15 @@ Documentation comments > : docnext { Just $1 } > | {- empty -} { Nothing } -> moduleheader :: { (Maybe ModuleInfo, Maybe Doc) } -> : DOCNEXT {% let (str, info) = parseModuleHeader $1 in -> case parseParas (tokenise str) of { -> Left err -> parseError err; -> Right doc -> returnP (info, Just doc); } } +> moduleheader :: { (ModuleInfo,Maybe Doc) } +> : DOCNEXT {% case parseModuleHeader $1 of { +> Right (str,info) -> +> case parseParas (tokenise str) of { +> Left err -> parseError err; +> Right doc -> returnP (info,Just doc); +> }; +> Left err -> parseError err +> } } ----------------------------------------------------------------------------- |