aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/HaddockLex.hs10
-rw-r--r--src/HaddockParse.y8
2 files changed, 15 insertions, 3 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
diff --git a/src/HaddockParse.y b/src/HaddockParse.y
index a406f3e4..87fb1af6 100644
--- a/src/HaddockParse.y
+++ b/src/HaddockParse.y
@@ -15,6 +15,7 @@ import HaddockTypes
URL { TokURL $$ }
'*' { TokBullet }
'(n)' { TokNumber }
+ '>' { TokBirdTrack }
PARA { TokPara }
STRING { TokString $$ }
@@ -44,9 +45,14 @@ olpara :: { ParsedDoc }
para :: { ParsedDoc }
: seq { docParagraph $1 }
+ | codepara { DocCodeBlock $1 }
+
+codepara :: { ParsedDoc }
+ : '>' seq codepara { docAppend $2 $3 }
+ | '>' seq { $2 }
seq :: { ParsedDoc }
- : elem seq { DocAppend $1 $2 }
+ : elem seq { docAppend $1 $2 }
| elem { $1 }
elem :: { ParsedDoc }