module Language.Haskell.GHC.ExactPrint.Lookup
  (
    keywordToString
  , AnnKeywordId(..)
  , Comment(..)
  ) where

import GHC (AnnKeywordId(..))
import Language.Haskell.GHC.ExactPrint.Types

-- | Maps `AnnKeywordId` to the corresponding String representation.
-- There is no specific mapping for the following constructors.
-- `AnnOpen`, `AnnClose`, `AnnVal`, `AnnPackageName`, `AnnHeader`, `AnnFunId`,
-- `AnnInfix`
keywordToString :: AnnKeywordId -> String
keywordToString :: AnnKeywordId -> String
keywordToString AnnKeywordId
kw =
  let mkErr :: a -> a
mkErr a
x = String -> a
forall a. HasCallStack => String -> a
error (String -> a) -> String -> a
forall a b. (a -> b) -> a -> b
$ String
"keywordToString: missing case for:" String -> String -> String
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
x
  in
  case AnnKeywordId
kw of
      -- Specifically handle all cases so that there are pattern match
      -- warnings if new constructors are added.
      AnnKeywordId
AnnAnyclass -> String
"anyclass"
      AnnKeywordId
AnnOpen -> AnnKeywordId -> String
forall {a} {a}. Show a => a -> a
mkErr AnnKeywordId
kw
      AnnKeywordId
AnnClose-> AnnKeywordId -> String
forall {a} {a}. Show a => a -> a
mkErr AnnKeywordId
kw
      AnnKeywordId
AnnVal  -> AnnKeywordId -> String
forall {a} {a}. Show a => a -> a
mkErr AnnKeywordId
kw
      AnnKeywordId
AnnPackageName -> AnnKeywordId -> String
forall {a} {a}. Show a => a -> a
mkErr AnnKeywordId
kw
      AnnKeywordId
AnnHeader-> AnnKeywordId -> String
forall {a} {a}. Show a => a -> a
mkErr AnnKeywordId
kw
      AnnKeywordId
AnnFunId -> AnnKeywordId -> String
forall {a} {a}. Show a => a -> a
mkErr AnnKeywordId
kw
      AnnKeywordId
AnnInfix -> AnnKeywordId -> String
forall {a} {a}. Show a => a -> a
mkErr AnnKeywordId
kw
      AnnKeywordId
AnnValStr-> AnnKeywordId -> String
forall {a} {a}. Show a => a -> a
mkErr AnnKeywordId
kw
      AnnKeywordId
AnnName  -> AnnKeywordId -> String
forall {a} {a}. Show a => a -> a
mkErr AnnKeywordId
kw
      AnnKeywordId
AnnAs    -> String
"as"
      AnnKeywordId
AnnAt    -> String
"@"
      AnnKeywordId
AnnBang  -> String
"!"
      AnnKeywordId
AnnBackquote-> String
"`"
      AnnKeywordId
AnnBy    -> String
"by"
      AnnKeywordId
AnnCase  -> String
"case"
      AnnKeywordId
AnnClass  -> String
"class"
      AnnKeywordId
AnnCloseB -> String
"|)"
      AnnKeywordId
AnnCloseBU-> String
"⦈"
      AnnKeywordId
AnnCloseC -> String
"}"
      AnnKeywordId
AnnCloseP -> String
")"
      AnnKeywordId
AnnClosePH-> String
"#)"
      AnnKeywordId
AnnCloseQ -> String
"|]"
      AnnKeywordId
AnnCloseQU-> String
"⟧"
      AnnKeywordId
AnnCloseS -> String
"]"
      AnnKeywordId
AnnColon  -> String
":"
      AnnKeywordId
AnnComma  -> String
","
      AnnKeywordId
AnnCommaTuple-> String
","
      AnnKeywordId
AnnDarrow -> String
"=>"
      AnnKeywordId
AnnData   -> String
"data"
      AnnKeywordId
AnnDcolon -> String
"::"
      AnnKeywordId
AnnDefault-> String
"default"
      AnnKeywordId
AnnDeriving-> String
"deriving"
      AnnKeywordId
AnnDo      -> String
"do"
      AnnKeywordId
AnnDot     -> String
"."
      AnnKeywordId
AnnDotdot  -> String
".."
      AnnKeywordId
AnnElse    -> String
"else"
      AnnKeywordId
AnnEqual   -> String
"="
      AnnKeywordId
AnnExport  -> String
"export"
      AnnKeywordId
AnnFamily  -> String
"family"
      AnnKeywordId
AnnForall  -> String
"forall"
      AnnKeywordId
AnnForeign -> String
"foreign"
      AnnKeywordId
AnnGroup   -> String
"group"
      AnnKeywordId
AnnHiding  -> String
"hiding"
      AnnKeywordId
AnnIf      -> String
"if"
      AnnKeywordId
AnnImport  -> String
"import"
      AnnKeywordId
AnnIn      -> String
"in"
      AnnKeywordId
AnnInstance-> String
"instance"
      AnnKeywordId
AnnLam     -> String
"\\"
      AnnKeywordId
AnnLarrow  -> String
"<-"
      AnnKeywordId
AnnLet     -> String
"let"
      AnnKeywordId
AnnLollyU  -> String
"⊸"
      AnnKeywordId
AnnMdo     -> String
"mdo"
      AnnKeywordId
AnnMinus   -> String
"-"
      AnnKeywordId
AnnModule  -> String
"module"
      AnnKeywordId
AnnNewtype -> String
"newtype"
      AnnKeywordId
AnnOf      -> String
"of"
      AnnKeywordId
AnnOpenB   -> String
"(|"
      AnnKeywordId
AnnOpenBU  ->  String
"⦇"
      AnnKeywordId
AnnOpenC   -> String
"{"
      AnnKeywordId
AnnOpenE   -> String
"[e|"
      AnnKeywordId
AnnOpenEQ  -> String
"[|"
      AnnKeywordId
AnnOpenEQU ->  String
"⟦"
      AnnKeywordId
AnnOpenP   -> String
"("
      AnnKeywordId
AnnOpenPH  -> String
"(#"
      AnnKeywordId
AnnOpenS   -> String
"["
      AnnKeywordId
AnnPattern -> String
"pattern"
      AnnKeywordId
AnnPercent  -> String
"%"
      AnnKeywordId
AnnPercentOne -> String
"%1"
      AnnKeywordId
AnnProc    -> String
"proc"
      AnnKeywordId
AnnQualified-> String
"qualified"
      AnnKeywordId
AnnRarrow  -> String
"->"
      AnnKeywordId
AnnRec     -> String
"rec"
      AnnKeywordId
AnnRole    -> String
"role"
      AnnKeywordId
AnnSafe    -> String
"safe"
      AnnKeywordId
AnnSemi    -> String
";"
      AnnKeywordId
AnnSignature -> String
"signature"
      AnnKeywordId
AnnStock   -> String
"stock"
      AnnKeywordId
AnnStatic  -> String
"static"
      AnnKeywordId
AnnThen    -> String
"then"
      AnnKeywordId
AnnTilde   -> String
"~"
      AnnKeywordId
AnnType    -> String
"type"
      AnnKeywordId
AnnUnit    -> String
"()"
      AnnKeywordId
AnnUsing   -> String
"using"
      AnnKeywordId
AnnVbar    -> String
"|"
      AnnKeywordId
AnnWhere   -> String
"where"
      AnnKeywordId
Annlarrowtail-> String
"-<"
      AnnKeywordId
Annrarrowtail-> String
">-"
      AnnKeywordId
AnnLarrowtail-> String
"-<<"
      AnnKeywordId
AnnRarrowtail-> String
">>-"
      AnnKeywordId
AnnSimpleQuote -> String
"'"
      AnnKeywordId
AnnThTyQuote   -> String
"''"
      AnnKeywordId
AnnDollar      -> String
"$"
      AnnKeywordId
AnnDollarDollar-> String
"$$"
      AnnKeywordId
AnnDarrowU     -> String
"⇒"
      AnnKeywordId
AnnDcolonU     -> String
"∷"
      AnnKeywordId
AnnForallU     -> String
"∀"
      AnnKeywordId
AnnLarrowU     -> String
"←"
      AnnKeywordId
AnnLarrowtailU -> String
"⤛"
      AnnKeywordId
AnnRarrowU     -> String
"→"
      AnnKeywordId
AnnRarrowtailU -> String
"⤜"
      AnnKeywordId
AnnlarrowtailU -> String
"⤙"
      AnnKeywordId
AnnrarrowtailU -> String
"⤚"
      -- AnnTypeApp             -> "@"
      AnnKeywordId
AnnVia -> String
"via"