aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/HaddockLex.hs2
-rw-r--r--src/HaddockParse.y19
2 files changed, 17 insertions, 4 deletions
diff --git a/src/HaddockLex.hs b/src/HaddockLex.hs
index 237d13a3..c7506ed3 100644
--- a/src/HaddockLex.hs
+++ b/src/HaddockLex.hs
@@ -11,7 +11,7 @@ module HaddockLex (
import Char
-special = "\'\"/[]"
+special = '`' : '\'' : '\"' : '@' : []
data Token
= TokPara
diff --git a/src/HaddockParse.y b/src/HaddockParse.y
index 87fb1af6..dfb1a116 100644
--- a/src/HaddockParse.y
+++ b/src/HaddockParse.y
@@ -8,10 +8,10 @@ import HaddockTypes
%tokentype { Token }
%token SQUO { TokSpecial '\'' }
+ BQUO { TokSpecial '`' }
DQUO { TokSpecial '\"' }
'/' { TokSpecial '/' }
- '[' { TokSpecial '[' }
- ']' { TokSpecial ']' }
+ '@' { TokSpecial '@' }
URL { TokURL $$ }
'*' { TokBullet }
'(n)' { TokNumber }
@@ -60,8 +60,21 @@ elem :: { ParsedDoc }
| '/' STRING '/' { DocEmphasis (DocString $2) }
| URL { DocURL $1 }
| SQUO STRING SQUO { DocIdentifier $2 }
+ | BQUO STRING SQUO { DocIdentifier $2 }
+ | DQUO STRING DQUO { DocModule $2 }
+ | '@' seq1 '@' { DocMonospaced $2 }
+
+seq1 :: { ParsedDoc }
+ : elem1 seq1 { docAppend $1 $2 }
+ | elem1 { $1 }
+
+elem1 :: { ParsedDoc }
+ : STRING { DocString $1 }
+ | '/' STRING '/' { DocEmphasis (DocString $2) }
+ | URL { DocURL $1 }
+ | SQUO STRING SQUO { DocIdentifier $2 }
+ | BQUO STRING SQUO { DocIdentifier $2 }
| DQUO STRING DQUO { DocModule $2 }
- | '[' seq ']' { DocMonospaced $2 }
{
happyError :: [Token] -> Either String a