aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/Haddock/Parse.y')
-rw-r--r--src/Haddock/Parse.y16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/Haddock/Parse.y b/src/Haddock/Parse.y
index c8a1a558..0befe395 100644
--- a/src/Haddock/Parse.y
+++ b/src/Haddock/Parse.y
@@ -35,8 +35,7 @@ import Data.List (stripPrefix)
'-' { (TokBullet,_) }
'(n)' { (TokNumber,_) }
'>..' { (TokBirdTrack $$,_) }
- PPROMPT { (TokPropertyPrompt $$,_) }
- PEXP { (TokPropertyExpression $$,_) }
+ PROP { (TokProperty $$,_) }
PROMPT { (TokExamplePrompt $$,_) }
RESULT { (TokExampleResult $$,_) }
EXP { (TokExampleExpression $$,_) }
@@ -75,15 +74,15 @@ defpara :: { (Doc RdrName, Doc RdrName) }
para :: { Doc RdrName }
: seq { docParagraph $1 }
| codepara { DocCodeBlock $1 }
- | property { DocProperty $1 }
+ | property { $1 }
| examples { DocExamples $1 }
codepara :: { Doc RdrName }
: '>..' codepara { docAppend (DocString $1) $2 }
| '>..' { DocString $1 }
-property :: { String }
- : PPROMPT PEXP { strip $2 }
+property :: { Doc RdrName }
+ : PROP { makeProperty $1 }
examples :: { [Example] }
: example examples { $1 : $2 }
@@ -136,6 +135,13 @@ makeHyperlink input = case break isSpace $ strip input of
(url, "") -> Hyperlink url Nothing
(url, label) -> Hyperlink url (Just . dropWhile isSpace $ label)
+makeProperty :: String -> Doc RdrName
+makeProperty s = case strip s of
+ 'p':'r':'o':'p':'>':xs ->
+ DocProperty (dropWhile isSpace xs)
+ xs ->
+ error $ "makeProperty: invalid input " ++ show xs
+
-- | Create an 'Example', stripping superfluous characters as appropriate
makeExample :: String -> String -> [String] -> Example
makeExample prompt expression result =