diff options
author | simonmar <unknown> | 2003-11-06 12:39:47 +0000 |
---|---|---|
committer | simonmar <unknown> | 2003-11-06 12:39:47 +0000 |
commit | 0a09c293d3d2294363a86f41bc74c3f5df123a08 (patch) | |
tree | f8e6cc8cc967de6d16d0be67390db1ed9504095d /src/HaddockLex.x | |
parent | a2bca16d0c180768949a8f30592bb072c907b965 (diff) |
[haddock @ 2003-11-06 12:39:46 by simonmar]
- Add definition lists, marked up like this:
-- | This is a definition list:
--
-- [@foo@] The description of @foo@.
--
-- [@bar@] The description of @bar@.
Cunningly, the [] characters are not treated specially unless a [ is
found at the beginning of a paragraph, in which case the ] becomes
special in the following text.
- Add --use-contents and --gen-contents, along the lines of
--use-index and --gen-index added yesterday. Now we can generate a
combined index and contents for the whole of the hierarchical
libraries, and in theory the index/contents on the system could
be updated as new packages are added.
Diffstat (limited to 'src/HaddockLex.x')
-rw-r--r-- | src/HaddockLex.x | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/HaddockLex.x b/src/HaddockLex.x index feac18ab..b4030700 100644 --- a/src/HaddockLex.x +++ b/src/HaddockLex.x @@ -14,7 +14,7 @@ import Char import HsSyn import HsLexer hiding (Token) import HsParseMonad -import Debug.Trace +--import Debug.Trace } $ws = $white # \n @@ -29,8 +29,9 @@ $ident = [$alphanum \_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~] <0,para> { $ws* \n ; $ws* \> { begin birdtrack } - $ws* [\*\-] { token TokBullet } - $ws* \( $digit+ \) { token TokNumber } + $ws* [\*\-] { token TokBullet `andBegin` string } + $ws* \[ { token TokDefStart `andBegin` def } + $ws* \( $digit+ \) { token TokNumber `andBegin` string } $ws* { begin string } } @@ -43,7 +44,7 @@ $ident = [$alphanum \_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~] <birdtrack> .* \n? { strtoken TokBirdTrack `andBegin` line } -<string> { +<string,def> { $special { strtoken $ \s -> TokSpecial (head s) } \<.*\> { strtoken $ \s -> TokURL (init (tail s)) } \#.*\# { strtoken $ \s -> TokAName (init (tail s)) } @@ -52,8 +53,18 @@ $ident = [$alphanum \_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~] -- allow special characters through if they don't fit one of the previous -- patterns. [\'\`\<\#\\] { strtoken TokString } - [^ $special \< \# \n \'\` \\]* \n { strtoken TokString `andBegin` line } - [^ $special \< \# \n \'\` \\]+ { strtoken TokString } + [^ $special \< \# \n \'\` \\ \]]* \n { strtoken TokString `andBegin` line } + [^ $special \< \# \n \'\` \\ \]]+ { strtoken TokString } +} + +<def> { + \] { token TokDefEnd `andBegin` string } +} + +-- ']' doesn't have any special meaning outside of the [...] at the beginning +-- of a definition paragraph. +<string> { + \] { strtoken TokString } } { @@ -61,6 +72,8 @@ data Token = TokPara | TokNumber | TokBullet + | TokDefStart + | TokDefEnd | TokSpecial Char | TokIdent [HsQName] | TokString String |