module Language.Python.Common.PrettyParseError where
import Language.Python.Common.Pretty
import Language.Python.Common.ParseError (ParseError (..))
import Language.Python.Common.SrcLocation
import Language.Python.Common.PrettyToken()
instance Pretty ParseError where
pretty :: ParseError -> Doc
pretty (UnexpectedToken t :: Token
t) = SrcSpan -> Doc
forall a. Pretty a => a -> Doc
pretty (Token -> SrcSpan
forall a. Span a => a -> SrcSpan
getSpan Token
t) Doc -> Doc -> Doc
<+> String -> Doc
text "unexpected token:" Doc -> Doc -> Doc
<+> Token -> Doc
forall a. Pretty a => a -> Doc
pretty Token
t
pretty (UnexpectedChar c :: Char
c loc :: SrcLocation
loc) = SrcLocation -> Doc
forall a. Pretty a => a -> Doc
pretty SrcLocation
loc Doc -> Doc -> Doc
<+> String -> Doc
text "unexpected characer:" Doc -> Doc -> Doc
<+> Char -> Doc
char Char
c
pretty (StrError str :: String
str) = String -> Doc
text String
str