haskell / attoparsec

A fast Haskell library for parsing ByteStrings
http://hackage.haskell.org/package/attoparsec
Other
512 stars 93 forks source link

Add getChunk function to access the rest of the current chunk #165

Closed Yuras closed 3 years ago

Yuras commented 4 years ago

The getChunk function returns the rest of the current chunk without consuming it.

Motivation

Often part of the parser is implemented without backtracking, in that case it could be beneficial to implement this particular part in a specialized non-backtracking parser and embed it into the top level backtracking parser. The getChunk allows one to do that.

The scanner package already can embed attoparsec parser into scanner using atto. Now I want to do the opposite thing, namely I want to embed scanner into attoparsec. Here is the prototype.

bgamari commented 3 years ago

This will be present in 0.14.1.