diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/parser/HaddockLex.hs-boot | 1 | ||||
-rw-r--r-- | compiler/parser/HaddockLex.x | 10 | ||||
-rw-r--r-- | compiler/parser/HaddockParse.y | 3 |
3 files changed, 9 insertions, 5 deletions
diff --git a/compiler/parser/HaddockLex.hs-boot b/compiler/parser/HaddockLex.hs-boot index abfc2d6667..3144744348 100644 --- a/compiler/parser/HaddockLex.hs-boot +++ b/compiler/parser/HaddockLex.hs-boot @@ -14,5 +14,6 @@ data Token | TokIdent [RdrName] | TokString String | TokURL String + | TokEmphasis String | TokAName String | TokBirdTrack String diff --git a/compiler/parser/HaddockLex.x b/compiler/parser/HaddockLex.x index f395976d0b..acc04d68ac 100644 --- a/compiler/parser/HaddockLex.x +++ b/compiler/parser/HaddockLex.x @@ -34,7 +34,7 @@ import System.IO.Unsafe $ws = $white # \n $digit = [0-9] $hexdigit = [0-9a-fA-F] -$special = [\"\@\/] +$special = [\"\@] $alphanum = [A-Za-z0-9] $ident = [$alphanum \'\_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~] @@ -69,15 +69,16 @@ $ident = [$alphanum \'\_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~] $special { strtoken $ \s -> TokSpecial (head s) } \<.*\> { strtoken $ \s -> TokURL (init (tail s)) } \#.*\# { strtoken $ \s -> TokAName (init (tail s)) } + \/ [^\/]* \/ { strtoken $ \s -> TokEmphasis (init (tail s)) } [\'\`] $ident+ [\'\`] { ident } \\ . { strtoken (TokString . tail) } "&#" $digit+ \; { strtoken $ \s -> TokString [chr (read (init (drop 2 s)))] } "&#" [xX] $hexdigit+ \; { strtoken $ \s -> case readHex (init (drop 3 s)) of [(n,_)] -> TokString [chr n] } -- 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 } + [\/\'\`\<\#\&\\] { strtoken TokString } + [^ $special \/ \< \# \n \'\` \& \\ \]]* \n { strtoken TokString `andBegin` line } + [^ $special \/ \< \# \n \'\` \& \\ \]]+ { strtoken TokString } } <def> { @@ -101,6 +102,7 @@ data Token | TokIdent [RdrName] | TokString String | TokURL String + | TokEmphasis String | TokAName String | TokBirdTrack String -- deriving Show diff --git a/compiler/parser/HaddockParse.y b/compiler/parser/HaddockParse.y index ded4dbe394..d59195716c 100644 --- a/compiler/parser/HaddockParse.y +++ b/compiler/parser/HaddockParse.y @@ -22,6 +22,7 @@ import RdrName DQUO { TokSpecial '\"' } URL { TokURL $$ } ANAME { TokAName $$ } + '/../' { TokEmphasis $$ } '-' { TokBullet } '(n)' { TokNumber } '>..' { TokBirdTrack $$ } @@ -80,7 +81,7 @@ seq1 :: { HsDoc RdrName } elem1 :: { HsDoc RdrName } : STRING { DocString $1 } - | '/' strings '/' { DocEmphasis (DocString $2) } + | '/../' { DocEmphasis (DocString $1) } | URL { DocURL $1 } | ANAME { DocAName $1 } | IDENT { DocIdentifier $1 } |