packages feed

Earley 0.12.1.0 → 0.13.0.0

raw patch · 6 files changed

+18/−22 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Text.Earley: namedSymbol :: Eq t => t -> Prod r e t t
- Text.Earley: symbol :: Eq t => t -> Prod r e t t
- Text.Earley: word :: Eq t => [t] -> Prod r e t [t]
- Text.Earley.Derived: namedSymbol :: Eq t => t -> Prod r e t t
- Text.Earley.Derived: symbol :: Eq t => t -> Prod r e t t
- Text.Earley.Derived: word :: Eq t => [t] -> Prod r e t [t]
- Text.Earley.Generator.Internal: instance Data.Semigroup.Semigroup (Text.Earley.Generator.Internal.Results s t a)
- Text.Earley.Grammar: instance (Data.String.IsString t, GHC.Classes.Eq t, a ~ t) => Data.String.IsString (Text.Earley.Grammar.Prod r e t a)
- Text.Earley.Grammar: instance Data.Semigroup.Semigroup (Text.Earley.Grammar.Prod r e t a)
- Text.Earley.Grammar: instance GHC.Base.Monoid (Text.Earley.Grammar.Prod r e t a)
- Text.Earley.Parser.Internal: instance (GHC.Classes.Eq i, GHC.Classes.Eq e) => GHC.Classes.Eq (Text.Earley.Parser.Internal.Report e i)
- Text.Earley.Parser.Internal: instance (GHC.Classes.Ord i, GHC.Classes.Ord e) => GHC.Classes.Ord (Text.Earley.Parser.Internal.Report e i)
- Text.Earley.Parser.Internal: instance (GHC.Read.Read i, GHC.Read.Read e) => GHC.Read.Read (Text.Earley.Parser.Internal.Report e i)
- Text.Earley.Parser.Internal: instance (GHC.Show.Show i, GHC.Show.Show e) => GHC.Show.Show (Text.Earley.Parser.Internal.Report e i)
- Text.Earley.Parser.Internal: instance Data.Semigroup.Semigroup (Text.Earley.Parser.Internal.Results s a)
+ Text.Earley.Generator.Internal: instance GHC.Base.Semigroup (Text.Earley.Generator.Internal.Results s t a)
+ Text.Earley.Grammar: instance (Data.String.IsString t, GHC.Classes.Eq t, a Data.Type.Equality.~ t) => Data.String.IsString (Text.Earley.Grammar.Prod r e t a)
+ Text.Earley.Grammar: instance GHC.Base.Monoid a => GHC.Base.Monoid (Text.Earley.Grammar.Prod r e t a)
+ Text.Earley.Grammar: instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Text.Earley.Grammar.Prod r e t a)
+ Text.Earley.Parser.Internal: instance (GHC.Classes.Eq e, GHC.Classes.Eq i) => GHC.Classes.Eq (Text.Earley.Parser.Internal.Report e i)
+ Text.Earley.Parser.Internal: instance (GHC.Classes.Ord e, GHC.Classes.Ord i) => GHC.Classes.Ord (Text.Earley.Parser.Internal.Report e i)
+ Text.Earley.Parser.Internal: instance (GHC.Read.Read e, GHC.Read.Read i) => GHC.Read.Read (Text.Earley.Parser.Internal.Report e i)
+ Text.Earley.Parser.Internal: instance (GHC.Show.Show e, GHC.Show.Show i) => GHC.Show.Show (Text.Earley.Parser.Internal.Report e i)
+ Text.Earley.Parser.Internal: instance GHC.Base.Semigroup (Text.Earley.Parser.Internal.Results s a)
- Text.Earley: Ended :: (Report e i) -> Result s e i a
+ Text.Earley: Ended :: Report e i -> Result s e i a
- Text.Earley: Parsed :: (ST s [a]) -> Int -> i -> (ST s (Result s e i a)) -> Result s e i a
+ Text.Earley: Parsed :: ST s [a] -> Int -> i -> ST s (Result s e i a) -> Result s e i a
- Text.Earley.Generator: Ended :: (ST s [(a, [t])]) -> Result s t a
+ Text.Earley.Generator: Ended :: ST s [(a, [t])] -> Result s t a
- Text.Earley.Generator: Generated :: (ST s [(a, [t])]) -> (ST s (Result s t a)) -> Result s t a
+ Text.Earley.Generator: Generated :: ST s [(a, [t])] -> ST s (Result s t a) -> Result s t a
- Text.Earley.Generator.Internal: Conts :: !(STRef s [Cont s r e t a c]) -> !(STRef s (Maybe (STRef s (Results s t a)))) -> Conts s r e t a c
+ Text.Earley.Generator.Internal: Conts :: !STRef s [Cont s r e t a c] -> !STRef s (Maybe (STRef s (Results s t a))) -> Conts s r e t a c
- Text.Earley.Generator.Internal: Ended :: (ST s [(a, [t])]) -> Result s t a
+ Text.Earley.Generator.Internal: Ended :: ST s [(a, [t])] -> Result s t a
- Text.Earley.Generator.Internal: Generated :: (ST s [(a, [t])]) -> (ST s (Result s t a)) -> Result s t a
+ Text.Earley.Generator.Internal: Generated :: ST s [(a, [t])] -> ST s (Result s t a) -> Result s t a
- Text.Earley.Generator.Internal: GenerationEnv :: ![ST s [(a, [t])]] -> ![State s a e t a] -> !(ST s ()) -> ![t] -> GenerationEnv s e t a
+ Text.Earley.Generator.Internal: GenerationEnv :: ![ST s [(a, [t])]] -> ![State s a e t a] -> !ST s () -> ![t] -> GenerationEnv s e t a
- Text.Earley.Generator.Internal: Rule :: ProdR s r e t a -> !(STRef s (STRef s [Cont s r e t a r])) -> !(Results s t a) -> Rule s r e t a
+ Text.Earley.Generator.Internal: Rule :: ProdR s r e t a -> !STRef s (STRef s [Cont s r e t a r]) -> !Results s t a -> Rule s r e t a
- Text.Earley.Generator.Internal: [Cont] :: !(a -> Results s t b) -> !(ProdR s r e t (b -> c)) -> !(c -> Results s t d) -> !(Conts s r e t d e') -> Cont s r e t a e'
+ Text.Earley.Generator.Internal: [Cont] :: !a -> Results s t b -> !ProdR s r e t (b -> c) -> !c -> Results s t d -> !Conts s r e t d e' -> Cont s r e t a e'
- Text.Earley.Generator.Internal: [Final] :: !(Results s t a) -> State s r e t a
+ Text.Earley.Generator.Internal: [Final] :: !Results s t a -> State s r e t a
- Text.Earley.Generator.Internal: [State] :: !(ProdR s r e t a) -> !(a -> Results s t b) -> !BirthPos -> !(Conts s r e t b c) -> State s r e t c
+ Text.Earley.Generator.Internal: [State] :: !ProdR s r e t a -> !a -> Results s t b -> !BirthPos -> !Conts s r e t b c -> State s r e t c
- Text.Earley.Generator.Internal: [contsArgs] :: Conts s r e t a c -> !(STRef s (Maybe (STRef s (Results s t a))))
+ Text.Earley.Generator.Internal: [contsArgs] :: Conts s r e t a c -> !STRef s (Maybe (STRef s (Results s t a)))
- Text.Earley.Generator.Internal: [conts] :: Conts s r e t a c -> !(STRef s [Cont s r e t a c])
+ Text.Earley.Generator.Internal: [conts] :: Conts s r e t a c -> !STRef s [Cont s r e t a c]
- Text.Earley.Generator.Internal: [reset] :: GenerationEnv s e t a -> !(ST s ())
+ Text.Earley.Generator.Internal: [reset] :: GenerationEnv s e t a -> !ST s ()
- Text.Earley.Generator.Internal: [ruleConts] :: Rule s r e t a -> !(STRef s (STRef s [Cont s r e t a r]))
+ Text.Earley.Generator.Internal: [ruleConts] :: Rule s r e t a -> !STRef s (STRef s [Cont s r e t a r])
- Text.Earley.Generator.Internal: [ruleNulls] :: Rule s r e t a -> !(Results s t a)
+ Text.Earley.Generator.Internal: [ruleNulls] :: Rule s r e t a -> !Results s t a
- Text.Earley.Grammar: [Alts] :: ![Prod r e t a] -> !(Prod r e t (a -> b)) -> Prod r e t b
+ Text.Earley.Grammar: [Alts] :: ![Prod r e t a] -> !Prod r e t (a -> b) -> Prod r e t b
- Text.Earley.Grammar: [Many] :: !(Prod r e t a) -> !(Prod r e t ([a] -> b)) -> Prod r e t b
+ Text.Earley.Grammar: [Many] :: !Prod r e t a -> !Prod r e t ([a] -> b) -> Prod r e t b
- Text.Earley.Grammar: [Named] :: !(Prod r e t a) -> e -> Prod r e t a
+ Text.Earley.Grammar: [Named] :: !Prod r e t a -> e -> Prod r e t a
- Text.Earley.Grammar: [NonTerminal] :: !(r e t a) -> !(Prod r e t (a -> b)) -> Prod r e t b
+ Text.Earley.Grammar: [NonTerminal] :: !r e t a -> !Prod r e t (a -> b) -> Prod r e t b
- Text.Earley.Grammar: [Terminal] :: !(t -> Maybe a) -> !(Prod r e t (a -> b)) -> Prod r e t b
+ Text.Earley.Grammar: [Terminal] :: !t -> Maybe a -> !Prod r e t (a -> b) -> Prod r e t b
- Text.Earley.Parser: Ended :: (Report e i) -> Result s e i a
+ Text.Earley.Parser: Ended :: Report e i -> Result s e i a
- Text.Earley.Parser: Parsed :: (ST s [a]) -> Int -> i -> (ST s (Result s e i a)) -> Result s e i a
+ Text.Earley.Parser: Parsed :: ST s [a] -> Int -> i -> ST s (Result s e i a) -> Result s e i a
- Text.Earley.Parser.Internal: Conts :: !(STRef s [Cont s r e t a c]) -> !(STRef s (Maybe (STRef s (Results s a)))) -> Conts s r e t a c
+ Text.Earley.Parser.Internal: Conts :: !STRef s [Cont s r e t a c] -> !STRef s (Maybe (STRef s (Results s a))) -> Conts s r e t a c
- Text.Earley.Parser.Internal: Ended :: (Report e i) -> Result s e i a
+ Text.Earley.Parser.Internal: Ended :: Report e i -> Result s e i a
- Text.Earley.Parser.Internal: ParseEnv :: ![ST s [a]] -> ![State s a e t a] -> !(ST s ()) -> ![e] -> !Int -> !i -> ParseEnv s e i t a
+ Text.Earley.Parser.Internal: ParseEnv :: ![ST s [a]] -> ![State s a e t a] -> !ST s () -> ![e] -> !Int -> !i -> ParseEnv s e i t a
- Text.Earley.Parser.Internal: Parsed :: (ST s [a]) -> Int -> i -> (ST s (Result s e i a)) -> Result s e i a
+ Text.Earley.Parser.Internal: Parsed :: ST s [a] -> Int -> i -> ST s (Result s e i a) -> Result s e i a
- Text.Earley.Parser.Internal: Rule :: ProdR s r e t a -> !(STRef s (STRef s [Cont s r e t a r])) -> !(Results s a) -> Rule s r e t a
+ Text.Earley.Parser.Internal: Rule :: ProdR s r e t a -> !STRef s (STRef s [Cont s r e t a r]) -> !Results s a -> Rule s r e t a
- Text.Earley.Parser.Internal: [Cont] :: !(a -> Results s b) -> !(ProdR s r e t (b -> c)) -> !(c -> Results s d) -> !(Conts s r e t d e') -> Cont s r e t a e'
+ Text.Earley.Parser.Internal: [Cont] :: !a -> Results s b -> !ProdR s r e t (b -> c) -> !c -> Results s d -> !Conts s r e t d e' -> Cont s r e t a e'
- Text.Earley.Parser.Internal: [Final] :: !(Results s a) -> State s r e t a
+ Text.Earley.Parser.Internal: [Final] :: !Results s a -> State s r e t a
- Text.Earley.Parser.Internal: [State] :: !(ProdR s r e t a) -> !(a -> Results s b) -> !BirthPos -> !(Conts s r e t b c) -> State s r e t c
+ Text.Earley.Parser.Internal: [State] :: !ProdR s r e t a -> !a -> Results s b -> !BirthPos -> !Conts s r e t b c -> State s r e t c
- Text.Earley.Parser.Internal: [contsArgs] :: Conts s r e t a c -> !(STRef s (Maybe (STRef s (Results s a))))
+ Text.Earley.Parser.Internal: [contsArgs] :: Conts s r e t a c -> !STRef s (Maybe (STRef s (Results s a)))
- Text.Earley.Parser.Internal: [conts] :: Conts s r e t a c -> !(STRef s [Cont s r e t a c])
+ Text.Earley.Parser.Internal: [conts] :: Conts s r e t a c -> !STRef s [Cont s r e t a c]
- Text.Earley.Parser.Internal: [reset] :: ParseEnv s e i t a -> !(ST s ())
+ Text.Earley.Parser.Internal: [reset] :: ParseEnv s e i t a -> !ST s ()
- Text.Earley.Parser.Internal: [ruleConts] :: Rule s r e t a -> !(STRef s (STRef s [Cont s r e t a r]))
+ Text.Earley.Parser.Internal: [ruleConts] :: Rule s r e t a -> !STRef s (STRef s [Cont s r e t a r])
- Text.Earley.Parser.Internal: [ruleNulls] :: Rule s r e t a -> !(Results s a)
+ Text.Earley.Parser.Internal: [ruleNulls] :: Rule s r e t a -> !Results s a

Files

CHANGELOG.md view
@@ -1,8 +1,14 @@ # Unreleased +# 0.13.0.0++- Remove the previously deprecated operators `symbol`, `namedSymbol`, and `word`+- Change `Prod`'s `Monoid` and `Semigroup` instances to lift their element instances instead of being the same as the `Alternative` instance+- Add unbalanced parentheses/EOF test+ # 0.12.1.0 -- GHC 8.4.1 support:+- GHC 8.4.1 support - Update 'base' dependency bounds - Add `Semigroup` instance to the `Prod` type 
Earley.cabal view
@@ -1,5 +1,5 @@ name:                Earley-version:             0.12.1.0+version:             0.13.0.0 synopsis:            Parsing all context-free grammars using Earley's algorithm. description:         See <https://www.github.com/ollef/Earley> for more                      information and@@ -9,7 +9,7 @@ license-file:        LICENSE author:              Olle Fredriksson maintainer:          fredriksson.olle@gmail.com-copyright:           (c) 2014-2017 Olle Fredriksson+copyright:           (c) 2014-2018 Olle Fredriksson category:            Parsing build-type:          Simple cabal-version:       >=1.10
Text/Earley.hs view
@@ -4,8 +4,6 @@     Prod, terminal, (<?>), Grammar, rule   , -- * Derived operators     satisfy, token, namedToken, list, listLike-  , -- * Deprecated operators-    symbol, namedSymbol, word   , -- * Parsing     Report(..), Parser.Result(..), Parser, parser, allParses, fullParses   , -- * Recognition
Text/Earley/Derived.hs view
@@ -32,15 +32,3 @@ {-# INLINE listLike #-} listLike :: (Eq t, ListLike i t) => i -> Prod r e t i listLike = ListLike.foldr (liftA2 ListLike.cons . satisfy . (==)) (pure ListLike.empty)--{-# DEPRECATED symbol "Use `token` instead" #-}-symbol :: Eq t => t -> Prod r e t t-symbol = token--{-# DEPRECATED namedSymbol "Use `namedToken` instead" #-}-namedSymbol :: Eq t => t -> Prod r e t t-namedSymbol = token--{-# DEPRECATED word "Use `list` or `listLike` instead" #-}-word :: Eq t => [t] -> Prod r e t [t]-word = list
Text/Earley/Grammar.hs view
@@ -64,12 +64,14 @@ (<?>) :: Prod r e t a -> e -> Prod r e t a (<?>) = Named -instance Semigroup (Prod r e t a) where-  (<>) = (<|>)+-- | Lifted instance: @(<>) = 'liftA2' ('<>')@+instance Semigroup a => Semigroup (Prod r e t a) where+  (<>) = liftA2 (Data.Semigroup.<>) -instance Monoid (Prod r e t a) where-  mempty  = empty-  mappend = (<|>)+-- | Lifted instance: @mempty = 'pure' 'mempty'@+instance Monoid a => Monoid (Prod r e t a) where+  mempty  = pure mempty+  mappend = liftA2 mappend  instance Functor (Prod r e t) where   {-# INLINE fmap #-}
tests/Main.hs view
@@ -11,6 +11,7 @@ import qualified Mixfix import qualified Optional import qualified ReversedWords+import qualified UnbalancedPars import qualified VeryAmbiguous  main :: IO ()@@ -25,5 +26,6 @@   , Mixfix.tests   , Optional.tests   , ReversedWords.tests+  , UnbalancedPars.tests   , VeryAmbiguous.tests   ]