aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockLex.hs
diff options
context:
space:
mode:
authorsimonmar <unknown>2002-05-07 15:37:15 +0000
committersimonmar <unknown>2002-05-07 15:37:15 +0000
commitadc8107866e9371b7b20e4e3985f9eca2e8ba52c (patch)
treea52a083d12fd3065e6258a036446e6cbf41be462 /src/HaddockLex.hs
parent65fc31db4405340f1ca1130ff37ef5147423c89a (diff)
[haddock @ 2002-05-07 15:37:15 by simonmar]
Allow code blocks to be denoted with bird-tracks in addition to [...].
Diffstat (limited to 'src/HaddockLex.hs')
-rw-r--r--src/HaddockLex.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/HaddockLex.hs b/src/HaddockLex.hs
index 84b369b3..237d13a3 100644
--- a/src/HaddockLex.hs
+++ b/src/HaddockLex.hs
@@ -20,6 +20,7 @@ data Token
| TokSpecial Char
| TokString String
| TokURL String
+ | TokBirdTrack
deriving Show
-- simple finite-state machine for tokenising the doc string
@@ -41,7 +42,8 @@ tokenise_url cs =
tokenise_newline cs =
case dropWhile nonNewlineSpace cs of
'\n':cs -> TokPara : tokenise_para cs -- paragraph break
- _other -> tokenise_string "\n" cs
+ '>':cs -> TokBirdTrack : tokenise cs -- bird track
+ _other -> tokenise_string "\n" cs
tokenise_para cs =
case dropWhile nonNewlineSpace cs of
@@ -50,6 +52,8 @@ tokenise_para cs =
-- bullet: '-'
'-':cs -> TokBullet : tokenise cs
-- enumerated item: '1.'
+ '>':cs -> TokBirdTrack : tokenise cs
+ -- bird track
str | (ds,'.':cs) <- span isDigit str, not (null ds)
-> TokNumber : tokenise cs
-- enumerated item: '(1)'
@@ -72,5 +76,7 @@ tokenise_string str cs =
tokenise_string_newline str cs =
case dropWhile nonNewlineSpace cs of
'\n':cs -> TokString (reverse str) : TokPara : tokenise_para cs
- _other -> tokenise_string ('\n':str) cs -- don't throw away whitespace
+ '>':cs -> TokString (reverse ('\n':str)) : TokBirdTrack : tokenise cs
+ -- bird track
+ _other -> tokenise_string ('\n':str) cs -- don't throw away whitespace