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 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 String
"unexpected token:" Doc -> Doc -> Doc
<+> Token -> Doc
forall a. Pretty a => a -> Doc
pretty Token
t
pretty (UnexpectedChar Char
c SrcLocation
loc) = SrcLocation -> Doc
forall a. Pretty a => a -> Doc
pretty SrcLocation
loc Doc -> Doc -> Doc
<+> String -> Doc
text String
"unexpected characer:" Doc -> Doc -> Doc
<+> Char -> Doc
char Char
c
pretty (StrError String
str) = String -> Doc
text String
str