@@ -76,6 +76,10 @@ p <?> msg =
7676 (Left _) -> Left (st, [msg])
7777 ok -> ok
7878
79+-- |get remaining input
80+getInput :: Parser C.ByteString C.ByteString
81+getInput = Parser (\st -> Right (st,st))
82+
7983
8084-- * Things like in @Parsec.Char@
8185
@@ -148,6 +152,13 @@ notEmpty (Parser p) =
148152 else o
149153 x -> x
150154
155+-- | parse some input with the given parser and return that input without copying it
156+pMatch :: Parser C.ByteString a -> Parser C.ByteString C.ByteString
157+pMatch p = do start <- getInput
158+ p
159+ end <- getInput
160+ return (C.take (C.length start - C.length end) start)
161+
151162
152163-- * Running parsers
153164