hpython-0.1: Syntax tree and DSL for Python

Safe HaskellNone
LanguageHaskell2010

Language.Python.Parse.Error

Contents

Synopsis

Documentation

data ParseError a Source #

Constructors

LexicalError (NonEmpty SourcePos) (Maybe (ErrorItem Char)) (Set (ErrorItem Char))

An error occured during tokenization (this is a re-packed megaparsec error)

ParseError (NonEmpty SourcePos) (Maybe (ErrorItem (PyToken a))) (Set (ErrorItem (PyToken a)))

An error occured during parsing (this is a re-packed megaparsec error)

TabError a

Tabs and spaces were used inconsistently

IncorrectDedent a

The dedent at the end of a block doesn't match and preceding indents

e.g.

def a():
    if b:
        pass
    else:
        pass
  pass

The final line will cause an IncorrectDedent error

InvalidUnpacking a

Unpacking ( *value ) was used in an invalid position

Instances
Eq a => Eq (ParseError a) Source # 
Instance details

Defined in Language.Python.Parse.Error

Methods

(==) :: ParseError a -> ParseError a -> Bool #

(/=) :: ParseError a -> ParseError a -> Bool #

Show a => Show (ParseError a) Source # 
Instance details

Defined in Language.Python.Parse.Error

AsIRError (ParseError a) a Source # 
Instance details

Defined in Language.Python.Parse.Error

Methods

_InvalidUnpacking :: Prism' (ParseError a) a Source #

AsIncorrectDedent (ParseError a) a Source # 
Instance details

Defined in Language.Python.Parse.Error

Methods

_IncorrectDedent :: Prism' (ParseError a) a Source #

AsTabError (ParseError a) a Source # 
Instance details

Defined in Language.Python.Parse.Error

Methods

_TabError :: Prism' (ParseError a) a Source #

AsLexicalError (ParseError a) Char Source # 
Instance details

Defined in Language.Python.Parse.Error

AsParseError (ParseError a) (PyToken a) Source # 
Instance details

Defined in Language.Python.Parse.Error

Classy Prisms

class AsLexicalError s t | s -> t where Source #

class AsTabError s a | s -> a where Source #

Methods

_TabError :: Prism' s a Source #

Instances
AsTabError (ParseError a) a Source # 
Instance details

Defined in Language.Python.Parse.Error

Methods

_TabError :: Prism' (ParseError a) a Source #

AsTabError (IndentationError a) a Source # 
Instance details

Defined in Language.Python.Validate.Indentation.Error

Methods

_TabError :: Prism' (IndentationError a) a Source #

AsTabError (ValidationError a) a Source # 
Instance details

Defined in Language.Python.Validate.Error

Methods

_TabError :: Prism' (ValidationError a) a Source #

class AsIncorrectDedent s a | s -> a where Source #

Methods

_IncorrectDedent :: Prism' s a Source #

Instances
AsIncorrectDedent (ParseError a) a Source # 
Instance details

Defined in Language.Python.Parse.Error

Methods

_IncorrectDedent :: Prism' (ParseError a) a Source #

class AsIRError s a | s -> a where Source #

Methods

_InvalidUnpacking :: Prism' s a Source #

Instances
AsIRError (ParseError a) a Source # 
Instance details

Defined in Language.Python.Parse.Error

Methods

_InvalidUnpacking :: Prism' (ParseError a) a Source #

class AsParseError s t | s -> t where Source #

Instances
AsParseError (ParseError a) (PyToken a) Source # 
Instance details

Defined in Language.Python.Parse.Error

Megaparsec re-exports

data ErrorItem t #

Instances
Functor ErrorItem 
Instance details

Defined in Text.Megaparsec.Error

Methods

fmap :: (a -> b) -> ErrorItem a -> ErrorItem b #

(<$) :: a -> ErrorItem b -> ErrorItem a #

Eq t => Eq (ErrorItem t) 
Instance details

Defined in Text.Megaparsec.Error

Methods

(==) :: ErrorItem t -> ErrorItem t -> Bool #

(/=) :: ErrorItem t -> ErrorItem t -> Bool #

Data t => Data (ErrorItem t) 
Instance details

Defined in Text.Megaparsec.Error

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ErrorItem t -> c (ErrorItem t) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ErrorItem t) #

toConstr :: ErrorItem t -> Constr #

dataTypeOf :: ErrorItem t -> DataType #

dataCast1 :: Typeable t0 => (forall d. Data d => c (t0 d)) -> Maybe (c (ErrorItem t)) #

dataCast2 :: Typeable t0 => (forall d e. (Data d, Data e) => c (t0 d e)) -> Maybe (c (ErrorItem t)) #

gmapT :: (forall b. Data b => b -> b) -> ErrorItem t -> ErrorItem t #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ErrorItem t -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ErrorItem t -> r #

gmapQ :: (forall d. Data d => d -> u) -> ErrorItem t -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ErrorItem t -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ErrorItem t -> m (ErrorItem t) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ErrorItem t -> m (ErrorItem t) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ErrorItem t -> m (ErrorItem t) #

Ord t => Ord (ErrorItem t) 
Instance details

Defined in Text.Megaparsec.Error

Read t => Read (ErrorItem t) 
Instance details

Defined in Text.Megaparsec.Error

Show t => Show (ErrorItem t) 
Instance details

Defined in Text.Megaparsec.Error

Generic (ErrorItem t) 
Instance details

Defined in Text.Megaparsec.Error

Associated Types

type Rep (ErrorItem t) :: Type -> Type #

Methods

from :: ErrorItem t -> Rep (ErrorItem t) x #

to :: Rep (ErrorItem t) x -> ErrorItem t #

NFData t => NFData (ErrorItem t) 
Instance details

Defined in Text.Megaparsec.Error

Methods

rnf :: ErrorItem t -> () #

(Ord t, ShowToken t) => ShowErrorComponent (ErrorItem t) 
Instance details

Defined in Text.Megaparsec.Error

type Rep (ErrorItem t) 
Instance details

Defined in Text.Megaparsec.Error

type Rep (ErrorItem t) = D1 (MetaData "ErrorItem" "Text.Megaparsec.Error" "megaparsec-6.5.0-7b380a41c7db9c6a4aad5bc0349f059f6770288935e8a88dbe061dc3475e1e3e" False) (C1 (MetaCons "Tokens" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NonEmpty t))) :+: (C1 (MetaCons "Label" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NonEmpty Char))) :+: C1 (MetaCons "EndOfInput" PrefixI False) (U1 :: Type -> Type)))

data SourcePos #

Constructors

SourcePos 

Fields

Instances
Eq SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

Data SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SourcePos -> c SourcePos #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SourcePos #

toConstr :: SourcePos -> Constr #

dataTypeOf :: SourcePos -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SourcePos) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SourcePos) #

gmapT :: (forall b. Data b => b -> b) -> SourcePos -> SourcePos #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r #

gmapQ :: (forall d. Data d => d -> u) -> SourcePos -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SourcePos -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos #

Ord SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

Read SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

Show SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

Generic SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

Associated Types

type Rep SourcePos :: Type -> Type #

NFData SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

Methods

rnf :: SourcePos -> () #

type Rep SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

type Rep SourcePos = D1 (MetaData "SourcePos" "Text.Megaparsec.Pos" "megaparsec-6.5.0-7b380a41c7db9c6a4aad5bc0349f059f6770288935e8a88dbe061dc3475e1e3e" False) (C1 (MetaCons "SourcePos" PrefixI True) (S1 (MetaSel (Just "sourceName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 FilePath) :*: (S1 (MetaSel (Just "sourceLine") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Pos) :*: S1 (MetaSel (Just "sourceColumn") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Pos))))