simple-parser-0.8.0: Simple parser combinators
Safe HaskellNone
LanguageHaskell2010

SimpleParser.Result

Synopsis

Documentation

data RawError chunk token Source #

Instances

Instances details
(Eq token, Eq chunk) => Eq (RawError chunk token) Source # 
Instance details

Defined in SimpleParser.Result

Methods

(==) :: RawError chunk token -> RawError chunk token -> Bool #

(/=) :: RawError chunk token -> RawError chunk token -> Bool #

(Show token, Show chunk) => Show (RawError chunk token) Source # 
Instance details

Defined in SimpleParser.Result

Methods

showsPrec :: Int -> RawError chunk token -> ShowS #

show :: RawError chunk token -> String #

showList :: [RawError chunk token] -> ShowS #

newtype StreamError s Source #

RawStreamError specialized to Stream types - newtyped to allow GHC to derive eq/show in the absense of type families.

Constructors

StreamError 

Fields

Instances

Instances details
(Eq (Token s), Eq (Chunk s)) => Eq (StreamError s) Source # 
Instance details

Defined in SimpleParser.Result

(Show (Token s), Show (Chunk s)) => Show (StreamError s) Source # 
Instance details

Defined in SimpleParser.Result

(Token s ~ Char, TextualChunked (Chunk s)) => ExplainError (StreamError s) Source # 
Instance details

Defined in SimpleParser.Explain

data CompoundError s e Source #

Instances

Instances details
Functor (CompoundError s) Source # 
Instance details

Defined in SimpleParser.Result

Methods

fmap :: (a -> b) -> CompoundError s a -> CompoundError s b #

(<$) :: a -> CompoundError s b -> CompoundError s a #

Foldable (CompoundError s) Source # 
Instance details

Defined in SimpleParser.Result

Methods

fold :: Monoid m => CompoundError s m -> m #

foldMap :: Monoid m => (a -> m) -> CompoundError s a -> m #

foldMap' :: Monoid m => (a -> m) -> CompoundError s a -> m #

foldr :: (a -> b -> b) -> b -> CompoundError s a -> b #

foldr' :: (a -> b -> b) -> b -> CompoundError s a -> b #

foldl :: (b -> a -> b) -> b -> CompoundError s a -> b #

foldl' :: (b -> a -> b) -> b -> CompoundError s a -> b #

foldr1 :: (a -> a -> a) -> CompoundError s a -> a #

foldl1 :: (a -> a -> a) -> CompoundError s a -> a #

toList :: CompoundError s a -> [a] #

null :: CompoundError s a -> Bool #

length :: CompoundError s a -> Int #

elem :: Eq a => a -> CompoundError s a -> Bool #

maximum :: Ord a => CompoundError s a -> a #

minimum :: Ord a => CompoundError s a -> a #

sum :: Num a => CompoundError s a -> a #

product :: Num a => CompoundError s a -> a #

Traversable (CompoundError s) Source # 
Instance details

Defined in SimpleParser.Result

Methods

traverse :: Applicative f => (a -> f b) -> CompoundError s a -> f (CompoundError s b) #

sequenceA :: Applicative f => CompoundError s (f a) -> f (CompoundError s a) #

mapM :: Monad m => (a -> m b) -> CompoundError s a -> m (CompoundError s b) #

sequence :: Monad m => CompoundError s (m a) -> m (CompoundError s a) #

(Eq (Token s), Eq (Chunk s), Eq e) => Eq (CompoundError s e) Source # 
Instance details

Defined in SimpleParser.Result

Methods

(==) :: CompoundError s e -> CompoundError s e -> Bool #

(/=) :: CompoundError s e -> CompoundError s e -> Bool #

(Show (Token s), Show (Chunk s), Show e) => Show (CompoundError s e) Source # 
Instance details

Defined in SimpleParser.Result

(Token s ~ Char, TextualChunked (Chunk s), ExplainError e) => ExplainError (CompoundError s e) Source # 
Instance details

Defined in SimpleParser.Explain

data Mark l s Source #

Constructors

Mark 

Fields

Instances

Instances details
(Eq l, Eq s) => Eq (Mark l s) Source # 
Instance details

Defined in SimpleParser.Result

Methods

(==) :: Mark l s -> Mark l s -> Bool #

(/=) :: Mark l s -> Mark l s -> Bool #

(Show l, Show s) => Show (Mark l s) Source # 
Instance details

Defined in SimpleParser.Result

Methods

showsPrec :: Int -> Mark l s -> ShowS #

show :: Mark l s -> String #

showList :: [Mark l s] -> ShowS #

data ParseError l s e Source #

Constructors

ParseError 

Fields

Instances

Instances details
(Eq l, Eq s, Eq (Token s), Eq (Chunk s), Eq e) => Eq (ParseError l s e) Source # 
Instance details

Defined in SimpleParser.Result

Methods

(==) :: ParseError l s e -> ParseError l s e -> Bool #

(/=) :: ParseError l s e -> ParseError l s e -> Bool #

(Show l, Show s, Show (Token s), Show (Chunk s), Show e) => Show (ParseError l s e) Source # 
Instance details

Defined in SimpleParser.Result

Methods

showsPrec :: Int -> ParseError l s e -> ShowS #

show :: ParseError l s e -> String #

showList :: [ParseError l s e] -> ShowS #

parseErrorResume :: ParseError l s e -> s Source #

Returns the resumption point of the ParseError. If it has been marked, we use that, otherwise we assume it starts at the exact error point.

parseErrorLabels :: ParseError l s e -> Seq l Source #

Returns the sequence of ALL labels from coarsest to finest.

markParseError :: Mark l s -> ParseError l s e -> ParseError l s e Source #

Updates a ParseError with a resumption point.

unmarkParseError :: ParseError l s e -> ParseError l s e Source #

Clears marks from a ParseError.

parseErrorEnclosingLabels :: ParseError l s e -> Seq l Source #

Returns labels enclosing the narrowest span, from coarsest to finest Does NOT include the label for the narrowest span (if any).

parseErrorNarrowestSpan :: PosStream s => ParseError l s e -> (Maybe l, Span (Pos s)) Source #

Returns the narrowest span

data ParseSuccess s a Source #

Constructors

ParseSuccess 

Fields

Instances

Instances details
Functor (ParseSuccess s) Source # 
Instance details

Defined in SimpleParser.Result

Methods

fmap :: (a -> b) -> ParseSuccess s a -> ParseSuccess s b #

(<$) :: a -> ParseSuccess s b -> ParseSuccess s a #

Foldable (ParseSuccess s) Source # 
Instance details

Defined in SimpleParser.Result

Methods

fold :: Monoid m => ParseSuccess s m -> m #

foldMap :: Monoid m => (a -> m) -> ParseSuccess s a -> m #

foldMap' :: Monoid m => (a -> m) -> ParseSuccess s a -> m #

foldr :: (a -> b -> b) -> b -> ParseSuccess s a -> b #

foldr' :: (a -> b -> b) -> b -> ParseSuccess s a -> b #

foldl :: (b -> a -> b) -> b -> ParseSuccess s a -> b #

foldl' :: (b -> a -> b) -> b -> ParseSuccess s a -> b #

foldr1 :: (a -> a -> a) -> ParseSuccess s a -> a #

foldl1 :: (a -> a -> a) -> ParseSuccess s a -> a #

toList :: ParseSuccess s a -> [a] #

null :: ParseSuccess s a -> Bool #

length :: ParseSuccess s a -> Int #

elem :: Eq a => a -> ParseSuccess s a -> Bool #

maximum :: Ord a => ParseSuccess s a -> a #

minimum :: Ord a => ParseSuccess s a -> a #

sum :: Num a => ParseSuccess s a -> a #

product :: Num a => ParseSuccess s a -> a #

Traversable (ParseSuccess s) Source # 
Instance details

Defined in SimpleParser.Result

Methods

traverse :: Applicative f => (a -> f b) -> ParseSuccess s a -> f (ParseSuccess s b) #

sequenceA :: Applicative f => ParseSuccess s (f a) -> f (ParseSuccess s a) #

mapM :: Monad m => (a -> m b) -> ParseSuccess s a -> m (ParseSuccess s b) #

sequence :: Monad m => ParseSuccess s (m a) -> m (ParseSuccess s a) #

(Eq s, Eq a) => Eq (ParseSuccess s a) Source # 
Instance details

Defined in SimpleParser.Result

Methods

(==) :: ParseSuccess s a -> ParseSuccess s a -> Bool #

(/=) :: ParseSuccess s a -> ParseSuccess s a -> Bool #

(Show s, Show a) => Show (ParseSuccess s a) Source # 
Instance details

Defined in SimpleParser.Result

data ParseResult l s e a Source #

Instances

Instances details
Functor (ParseResult l s e) Source # 
Instance details

Defined in SimpleParser.Result

Methods

fmap :: (a -> b) -> ParseResult l s e a -> ParseResult l s e b #

(<$) :: a -> ParseResult l s e b -> ParseResult l s e a #

Foldable (ParseResult l s e) Source # 
Instance details

Defined in SimpleParser.Result

Methods

fold :: Monoid m => ParseResult l s e m -> m #

foldMap :: Monoid m => (a -> m) -> ParseResult l s e a -> m #

foldMap' :: Monoid m => (a -> m) -> ParseResult l s e a -> m #

foldr :: (a -> b -> b) -> b -> ParseResult l s e a -> b #

foldr' :: (a -> b -> b) -> b -> ParseResult l s e a -> b #

foldl :: (b -> a -> b) -> b -> ParseResult l s e a -> b #

foldl' :: (b -> a -> b) -> b -> ParseResult l s e a -> b #

foldr1 :: (a -> a -> a) -> ParseResult l s e a -> a #

foldl1 :: (a -> a -> a) -> ParseResult l s e a -> a #

toList :: ParseResult l s e a -> [a] #

null :: ParseResult l s e a -> Bool #

length :: ParseResult l s e a -> Int #

elem :: Eq a => a -> ParseResult l s e a -> Bool #

maximum :: Ord a => ParseResult l s e a -> a #

minimum :: Ord a => ParseResult l s e a -> a #

sum :: Num a => ParseResult l s e a -> a #

product :: Num a => ParseResult l s e a -> a #

Traversable (ParseResult l s e) Source # 
Instance details

Defined in SimpleParser.Result

Methods

traverse :: Applicative f => (a -> f b) -> ParseResult l s e a -> f (ParseResult l s e b) #

sequenceA :: Applicative f => ParseResult l s e (f a) -> f (ParseResult l s e a) #

mapM :: Monad m => (a -> m b) -> ParseResult l s e a -> m (ParseResult l s e b) #

sequence :: Monad m => ParseResult l s e (m a) -> m (ParseResult l s e a) #

(Eq l, Eq s, Eq (Token s), Eq (Chunk s), Eq e, Eq a) => Eq (ParseResult l s e a) Source # 
Instance details

Defined in SimpleParser.Result

Methods

(==) :: ParseResult l s e a -> ParseResult l s e a -> Bool #

(/=) :: ParseResult l s e a -> ParseResult l s e a -> Bool #

(Show l, Show s, Show (Token s), Show (Chunk s), Show e, Show a) => Show (ParseResult l s e a) Source # 
Instance details

Defined in SimpleParser.Result

Methods

showsPrec :: Int -> ParseResult l s e a -> ShowS #

show :: ParseResult l s e a -> String #

showList :: [ParseResult l s e a] -> ShowS #

matchSoleParseError :: NESeq (ParseError l s e) -> Maybe (ParseError l s e) Source #

If there is one parse error, return it, otherwise return nothing. Errors can accumulate if you use unrestricted branching (with orParser or Alternative <|>) or manual Parser constructor application. However, if you always branch with lookAheadMatch then you will have singleton parse errors, and this will always return Just.