{-# LANGUAGE PatternSynonyms, OverloadedStrings #-}
module Haddock.Backends.Hyperlinker.Types where
import qualified GHC
import Data.ByteString ( ByteString )
import Data.Map (Map)
data Token = Token
{ Token -> TokenType
tkType :: TokenType
, Token -> ByteString
tkValue :: ByteString
, Token -> Span
tkSpan :: {-# UNPACK #-} !Span
}
deriving (Int -> Token -> ShowS
[Token] -> ShowS
Token -> String
(Int -> Token -> ShowS)
-> (Token -> String) -> ([Token] -> ShowS) -> Show Token
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Token] -> ShowS
$cshowList :: [Token] -> ShowS
show :: Token -> String
$cshow :: Token -> String
showsPrec :: Int -> Token -> ShowS
$cshowsPrec :: Int -> Token -> ShowS
Show)
pattern BacktickTok, OpenParenTok, CloseParenTok :: Span -> Token
pattern $bBacktickTok :: Span -> Token
$mBacktickTok :: forall r. Token -> (Span -> r) -> (Void# -> r) -> r
BacktickTok sp = Token TkSpecial "`" sp
pattern $bOpenParenTok :: Span -> Token
$mOpenParenTok :: forall r. Token -> (Span -> r) -> (Void# -> r) -> r
OpenParenTok sp = Token TkSpecial "(" sp
pattern $bCloseParenTok :: Span -> Token
$mCloseParenTok :: forall r. Token -> (Span -> r) -> (Void# -> r) -> r
CloseParenTok sp = Token TkSpecial ")" sp
type Position = GHC.RealSrcLoc
type Span = GHC.RealSrcSpan
data TokenType
= TkIdentifier
| TkKeyword
| TkString
| TkChar
| TkNumber
| TkOperator
| TkGlyph
| TkSpecial
| TkSpace
|
| TkCpp
| TkPragma
| TkUnknown
deriving (Int -> TokenType -> ShowS
[TokenType] -> ShowS
TokenType -> String
(Int -> TokenType -> ShowS)
-> (TokenType -> String)
-> ([TokenType] -> ShowS)
-> Show TokenType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TokenType] -> ShowS
$cshowList :: [TokenType] -> ShowS
show :: TokenType -> String
$cshow :: TokenType -> String
showsPrec :: Int -> TokenType -> ShowS
$cshowsPrec :: Int -> TokenType -> ShowS
Show, TokenType -> TokenType -> Bool
(TokenType -> TokenType -> Bool)
-> (TokenType -> TokenType -> Bool) -> Eq TokenType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TokenType -> TokenType -> Bool
$c/= :: TokenType -> TokenType -> Bool
== :: TokenType -> TokenType -> Bool
$c== :: TokenType -> TokenType -> Bool
Eq)
data SrcPath
= SrcExternal FilePath
| SrcLocal
type SrcMaps = (Map GHC.Module SrcPath, Map GHC.ModuleName SrcPath)