parsec-permutation 0.1.1.0 → 0.1.2.0
raw patch · 3 files changed
+13/−7 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
Text/Parsec/Permutation.hs view
@@ -32,8 +32,10 @@ where import Control.Monad (void)-import Control.Applicative ((<*>), (<$>), Applicative, pure)-import Text.Parsec ((<|>), ParsecT, Stream, parserZero, optionMaybe, unexpected)+import Control.Applicative+ ((<*>), (<$>), Applicative, pure)+import Text.Parsec+ ((<|>), ParsecT, Stream, parserZero, optionMaybe, unexpected, lookAhead) data PermParser s u m a = PermParser {@@ -66,10 +68,13 @@ -- | Similar to runPermParser, but attempts parsing permutations only until the -- given @untilParser@ succeeds (similar to @manyTill@ in Text.Parsec).+--+-- The text parsed by the untilParser is not consumed, however, so that its+-- contents can be parsed later if necessary. runPermParserTill :: Stream s m t => ParsecT s u m end -> PermParser s u m a -> ParsecT s u m a runPermParserTill untilParser (PermParser value parser) =- do void $ untilParser+ do void $ lookAhead untilParser fromJustOrFail value <|> do result <- optionMaybe parser
parsec-permutation.cabal view
@@ -1,5 +1,5 @@ name: parsec-permutation-version: 0.1.1.0+version: 0.1.2.0 synopsis: Applicative permutation parser for Parsec intended as a replacement for Text.Parsec.Perm. license: BSD3
tests/PermutationTest.hs view
@@ -34,18 +34,19 @@ <*> oncePerm (char 'f') <*> oncePerm (char 'd') <*> optionMaybePerm (char 'a')- <*> optionMaybePerm (char 'x')) <* char 'a')+ <*> optionMaybePerm (char 'x')) <* string "xa") == ('n','s','f','d',Nothing,Nothing) prop_oncePermTill2 :: Property prop_oncePermTill2 = once $- (requireParse "sdfax" $ runPermParserTill (char 'x') $+ (requireParse "sdfax" $ (runPermParserTill (char 'x') $ (,,,,,) <$> pure 'n' <*> oncePerm (char 's') <*> oncePerm (char 'f') <*> oncePerm (char 'd') <*> optionMaybePerm (char 'a')- <*> optionMaybePerm (char 'x')) == ('n','s','f','d',Just 'a',Nothing)+ <*> optionMaybePerm (char 'x')) <* char 'x')+ == ('n','s','f','d',Just 'a',Nothing) prop_oncePerm :: Property prop_oncePerm = once $