@@ -85,9 +85,9 @@ module Streamly.Internal.Data.Parser
85 -- , take -- takeBetween 0 n
85 -- , take -- takeBetween 0 n
86 , takeEQ -- takeBetween n n
86 , takeEQ -- takeBetween n n
87 , takeGE -- takeBetween n maxBound
87 , takeGE -- takeBetween n maxBound
89 -- Grab a sequence of input elements by inspecting them
90 -- Grab a sequence of input elements by inspecting them
91 , lookAhead
91 , lookAhead
92 , takeWhileP
92 , takeWhileP
93 , takeWhile
93 , takeWhile
@@ -95,16 +95,22 @@ module Streamly.Internal.Data.Parser
95 , takeWhile1
95 , takeWhile1
96 , drainWhile
96 , drainWhile
98 , sliceSepByP
99 , sliceSepByP
99 , sliceBeginWith
100 , sliceBeginWith
100 , sliceSepWith
101 , sliceSepWith
103+ -- Quoting and Escaping
101 , escapedSliceSepBy
104 , escapedSliceSepBy
102 , escapedFrameBy
105 , escapedFrameBy
107+ -- Words and grouping
104 , groupBy
109 , groupBy
105 , groupByRolling
110 , groupByRolling
106 , groupByRollingEither
111 , groupByRollingEither
108 -- | Unimplemented
114 -- | Unimplemented
@@ -498,6 +504,10 @@ takeEQ n = D.toParserK . D.takeEQ n
498takeGE :: MonadCatch m => Int -> Fold m a b -> Parser m a b
504takeGE :: MonadCatch m => Int -> Fold m a b -> Parser m a b
499takeGE n = D.toParserK . D.takeGE n
505takeGE n = D.toParserK . D.takeGE n
507+-------------------------------------------------------------------------------
508+-- Take until a condition
509+-------------------------------------------------------------------------------
501-- $takeWhile
511-- $takeWhile
502-- Note: This is called @takeWhileP@ and @munch@ in some parser libraries.
512-- Note: This is called @takeWhileP@ and @munch@ in some parser libraries.
@@ -562,6 +572,10 @@ takeWhile1 cond = D.toParserK . D.takeWhile1 cond
562drainWhile :: MonadCatch m => (a -> Bool) -> Parser m a ()
572drainWhile :: MonadCatch m => (a -> Bool) -> Parser m a ()
563drainWhile p = takeWhile p FL.drain
573drainWhile p = takeWhile p FL.drain
575+-------------------------------------------------------------------------------
577+-------------------------------------------------------------------------------
565-- | @sliceSepByP cond parser@ parses a slice of the input using @parser@ until
579-- | @sliceSepByP cond parser@ parses a slice of the input using @parser@ until
566-- @cond@ succeeds or the parser stops.
580-- @cond@ succeeds or the parser stops.
@@ -630,6 +644,10 @@ sliceBeginWith ::
630 (a -> Bool) -> Fold m a b -> Parser m a b
644 (a -> Bool) -> Fold m a b -> Parser m a b
631sliceBeginWith cond = D.toParserK . D.sliceBeginWith cond
645sliceBeginWith cond = D.toParserK . D.sliceBeginWith cond
647+-------------------------------------------------------------------------------
648+-- Quoting and Escaping
649+-------------------------------------------------------------------------------
633-- | Like 'sliceSepBy' but the separator elements can be escaped using an
651-- | Like 'sliceSepBy' but the separator elements can be escaped using an
634-- escape char determined by the second predicate.
652-- escape char determined by the second predicate.
@@ -669,6 +687,10 @@ escapedFrameBy :: -- MonadCatch m =>
669escapedFrameBy _begin _end _escape _p = undefined
687escapedFrameBy _begin _end _escape _p = undefined
670 -- D.toParserK . D.frameBy begin end escape p
688 -- D.toParserK . D.frameBy begin end escape p
690+-------------------------------------------------------------------------------
691+-- Grouping and words
692+-------------------------------------------------------------------------------
672-- | Like 'splitOn' but strips leading, trailing, and repeated separators.
694-- | Like 'splitOn' but strips leading, trailing, and repeated separators.
673-- Therefore, @".a..b."@ having '.' as the separator would be parsed as
695-- Therefore, @".a..b."@ having '.' as the separator would be parsed as
674-- @["a","b"]@. In other words, its like parsing words from whitespace
696-- @["a","b"]@. In other words, its like parsing words from whitespace