X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fparser%2FHaddockLex.x;fp=compiler%2Fparser%2FHaddockLex.x;h=acc04d68ac8d2c20cb8fc40927ea67610505ebbe;hb=70e996b9a6cd657d441cba95014304a588c0fd7c;hp=f395976d0badfed679d77366234886d9484666bb;hpb=92e7ecbcc393caab7f0d8883a51cbfca42767cb1;p=ghc-hetmet.git diff --git a/compiler/parser/HaddockLex.x b/compiler/parser/HaddockLex.x index f395976..acc04d6 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 } } { @@ -101,6 +102,7 @@ data Token | TokIdent [RdrName] | TokString String | TokURL String + | TokEmphasis String | TokAName String | TokBirdTrack String -- deriving Show