File tree 4 files changed +21
-19
lines changed
4 files changed +21
-19
lines changed Original file line number Diff line number Diff line change
1
+ ### 3.1.17.0
2
+
3
+ - Move ` many1 :: ParsecT s u m a -> ParsecT s u m [a] ` to ` Text.Parsec.Prim ` .
4
+ Drop ` Stream ` constraint requirement.
5
+ - Implement ` Alternative.many/some ` using ` Text.Parsec.Prim.many/many1 ` ,
6
+ instead of default implementation.
7
+
1
8
### 3.1.16.0
2
9
3
10
- Add ` tokens' ` and ` string' ` combinators which don't consume the prefix.
Original file line number Diff line number Diff line change 1
1
cabal-version : 1.12
2
2
name : parsec
3
- version : 3.1.16.1
3
+ version : 3.1.17.0
4
4
5
5
synopsis : Monadic parser combinators
6
6
description : Parsec is designed from scratch as an industrial-strength parser
Original file line number Diff line number Diff line change @@ -106,24 +106,6 @@ skipMany p = scan
106
106
scan = do{ p; scan } <|> return ()
107
107
-}
108
108
109
- -- | @many1 p@ applies the parser @p@ /one/ or more times. Returns a
110
- -- list of the returned values of @p@.
111
- --
112
- -- > word = many1 letter
113
-
114
- many1 :: (Stream s m t ) => ParsecT s u m a -> ParsecT s u m [a ]
115
- {-# INLINABLE many1 #-}
116
- many1 p = do { x <- p; xs <- many p; return (x: xs) }
117
- {-
118
- many p = scan id
119
- where
120
- scan f = do{ x <- p
121
- ; scan (\tail -> f (x:tail))
122
- }
123
- <|> return (f [])
124
- -}
125
-
126
-
127
109
-- | @sepBy p sep@ parses /zero/ or more occurrences of @p@, separated
128
110
-- by @sep@. Returns a list of values returned by @p@.
129
111
--
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ module Text.Parsec.Prim
61
61
, many
62
62
, skipMany
63
63
, manyAccum
64
+ , many1
64
65
, runPT
65
66
, runP
66
67
, runParserT
@@ -270,6 +271,9 @@ instance Applicative.Alternative (ParsecT s u m) where
270
271
empty = mzero
271
272
(<|>) = mplus
272
273
274
+ many = many
275
+ some = many1
276
+
273
277
instance Monad (ParsecT s u m ) where
274
278
return = Applicative. pure
275
279
p >>= f = parserBind p f
@@ -715,6 +719,15 @@ many p
715
719
= do xs <- manyAccum (:) p
716
720
return (reverse xs)
717
721
722
+ -- | @many1 p@ applies the parser @p@ /one/ or more times. Returns a
723
+ -- list of the returned values of @p@.
724
+ --
725
+ -- > word = many1 letter
726
+
727
+ many1 :: ParsecT s u m a -> ParsecT s u m [a ]
728
+ {-# INLINABLE many1 #-}
729
+ many1 p = do { x <- p; xs <- many p; return (x: xs) }
730
+
718
731
-- | @skipMany p@ applies the parser @p@ /zero/ or more times, skipping
719
732
-- its result.
720
733
--
You can’t perform that action at this time.
0 commit comments