aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonmar <unknown>2002-05-29 09:09:49 +0000
committersimonmar <unknown>2002-05-29 09:09:49 +0000
commit093f7e538e89d8f9a1f8362ba76a233b7c286a4f (patch)
treeaaad2f56e181ee3d873702c37d26709bc690f1ed
parent7e474ebfea020e4ed59324fbd9f8baf4b6fab705 (diff)
[haddock @ 2002-05-29 09:09:49 by simonmar]
Back out previous change until we can find a better way to do this.
-rw-r--r--src/HaddockLex.hs14
-rw-r--r--src/HaddockParse.y4
2 files changed, 3 insertions, 15 deletions
diff --git a/src/HaddockLex.hs b/src/HaddockLex.hs
index f1646453..f766222d 100644
--- a/src/HaddockLex.hs
+++ b/src/HaddockLex.hs
@@ -11,7 +11,7 @@ module HaddockLex (
import Char
-special = '`' : '\'' : '\"' : '@' : []
+special = '`' : '\'' : '\"' : '@' : '/' : []
data Token
= TokPara
@@ -19,7 +19,6 @@ data Token
| TokBullet
| TokSpecial Char
| TokString String
- | TokEmph String
| TokURL String
| TokBirdTrack
deriving Show
@@ -34,7 +33,6 @@ tokenise "" = []
tokenise str = case str of
'<':cs -> tokenise_url cs
'\n':cs -> tokenise_newline tokenise cs
- '/':cs -> tokenise_emph tokenise cs
c:cs | c `elem` special -> TokSpecial c : tokenise cs
_other -> tokenise_string "" str
@@ -44,12 +42,6 @@ tokenise_newline next cs =
'>':cs -> TokBirdTrack : next cs -- bird track
_other -> tokenise_string "" cs
-tokenise_emph next cs =
- case break newlineSlash cs of
- (bef, aft@('\n':cs)) -> TokString ('/':bef) : next aft -- paragraph break
- (bef, '/':cs) -> TokEmph bef : next cs
- _other -> tokenise_string "" cs
-
tokenise_para cs =
case dropWhile nonNewlineSpace cs of
-- bullet: '*'
@@ -68,8 +60,6 @@ tokenise_para cs =
nonNewlineSpace c = isSpace c && c /= '\n'
-newlineSlash c = c == '\n' || c == '/'
-
-- ----------------------------------------------------------------------------
-- Within a paragraph, we don't throw away any whitespace (except before a
-- birdtrack, and before a paragraph break).
@@ -79,7 +69,6 @@ tokenise1 "" = []
tokenise1 str = case str of
'<':cs -> tokenise_url cs
'\n':cs -> tokenise_newline1 cs
- '/':cs -> tokenise_emph tokenise1 cs
c:cs | c `elem` special -> TokSpecial c : tokenise1 cs
_other -> tokenise_string "" str
@@ -104,7 +93,6 @@ tokenise_string str cs =
'\\':c:cs -> tokenise_string (c:str) cs
'\n':cs -> tokenise_string_newline str cs
'<':cs -> TokString (reverse str) : tokenise_url cs
- '/':cs -> TokString (reverse str) : tokenise_emph (tokenise_string "") cs
c:cs | c `elem` special -> TokString (reverse str) : tokenise1 (c:cs)
| otherwise -> tokenise_string (c:str) cs
diff --git a/src/HaddockParse.y b/src/HaddockParse.y
index 17fbf2f4..f74d2b69 100644
--- a/src/HaddockParse.y
+++ b/src/HaddockParse.y
@@ -12,13 +12,13 @@ import HsParseMonad
%token SQUO { TokSpecial '\'' }
BQUO { TokSpecial '`' }
DQUO { TokSpecial '\"' }
+ '/' { TokSpecial '/' }
'@' { TokSpecial '@' }
URL { TokURL $$ }
'*' { TokBullet }
'(n)' { TokNumber }
'>' { TokBirdTrack }
PARA { TokPara }
- EMPH { TokEmph $$ }
STRING { TokString $$ }
%monad { Either String }
@@ -67,7 +67,7 @@ seq1 :: { Doc }
elem1 :: { Doc }
: STRING { DocString $1 }
- | EMPH { DocEmphasis (DocString $1) }
+ | '/' STRING '/' { DocEmphasis (DocString $2) }
| URL { DocURL $1 }
| squo STRING squo { strToHsQNames $2 }
| DQUO STRING DQUO { DocModule $2 }