aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Lex.x
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2011-11-26 04:20:12 +0100
committerDavid Waern <david.waern@gmail.com>2011-11-26 04:20:12 +0100
commit3ebdc745d7bc79307986332dc71f3495099b4579 (patch)
treec1e15b26b65e079a52000b37791077eee687d659 /src/Haddock/Lex.x
parentc3278a9d3c17ea0929d39116e431a2839bb845ca (diff)
Give preference to type over data constructors for doc comment links at renaming time.
Previously this was done in the backends. Also, warn when a doc comment refers to something that is in scope but which we don't have the .haddock file for. These changes mean we can make DocIdentifier [a] into DocIdentifier a.
Diffstat (limited to 'src/Haddock/Lex.x')
-rw-r--r--src/Haddock/Lex.x10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Haddock/Lex.x b/src/Haddock/Lex.x
index 153f6677..f65aee8c 100644
--- a/src/Haddock/Lex.x
+++ b/src/Haddock/Lex.x
@@ -121,7 +121,7 @@ data Token
| TokDefStart
| TokDefEnd
| TokSpecial Char
- | TokIdent [RdrName]
+ | TokIdent RdrName
| TokString String
| TokURL String
| TokPic String
@@ -209,7 +209,7 @@ begin sc = \_ _ _ cont _ -> cont sc
ident :: Action
ident pos str sc cont dflags =
- case strToHsQNames dflags loc id of
+ case parseIdent dflags loc id of
Just names -> (TokIdent names, pos) : cont sc
Nothing -> (TokString str, pos) : cont sc
where id = init (tail str)
@@ -220,12 +220,12 @@ ident pos str sc cont dflags =
AlexPn _ line col ->
mkRealSrcLoc filename line col
-strToHsQNames :: DynFlags -> RealSrcLoc -> String -> Maybe [RdrName]
-strToHsQNames dflags loc str0 =
+parseIdent :: DynFlags -> RealSrcLoc -> String -> Maybe RdrName
+parseIdent dflags loc str0 =
let buffer = stringToStringBuffer str0
pstate = mkPState dflags buffer loc
result = unP parseIdentifier pstate
in case result of
- POk _ name -> Just [unLoc name]
+ POk _ name -> Just (unLoc name)
_ -> Nothing
}