-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initially feeding a parser with empty string results in non-obvious parse #75
Comments
Smaller repro: {-# LANGUAGE OverloadedStrings #-}
import Data.ByteString
import Control.Applicative
import qualified Data.Attoparsec.ByteString.Char8 as A
wat :: A.Parser ByteString
wat = do
"a"
"b" <|> ("empty" <$ "") |
Thanks! |
Closed
mamash
pushed a commit
to TritonDataCenter/pkgsrc-wip
that referenced
this issue
Sep 6, 2014
changelog: 0.12.1.2 * Fixed the incorrect tracking of capacity if the initial buffer was empty (haskell/attoparsec#75) 0.12.1.1 * Fixed a data corruption bug that occurred under some circumstances if a buffer grew after prompting for more input (haskell/attoparsec#74) 0.12.1.0 * Now compatible with GHC 7.9 * Reintroduced the Chunk class, used by the parsers package 0.12.0.0 * A new internal representation makes almost all real-world parsers faster, sometimes by big margins. For example, parsing JSON data with aeson is now up to 70% faster. These performance improvements also come with reduced memory consumption and some new capabilities. * The new match combinator gives both the result of a parse and the input that it matched. * The test suite has doubled in size. This made it possible to switch to the new internal representation with a decent degree of confidence that everything was more or less working. * The benchmark suite now contains a small family of benchmarks taken from real-world uses of attoparsec. * A few types that ought to have been private now are. * A few obsolete modules and functions have been marked as deprecated. They will be removed from the next major release. 0.11.3.0 * New function scientific is compatible with rational, but parses integers more efficiently (haskell/aeson#198) 0.11.2.0 * The new Chunk typeclass allows for some code sharing with Ed Kmett's parsers package: http://hackage.haskell.org/package/parsers * New function runScanner generalises scan to return the final state of the scanner as well as the input consumed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While writing a parser
Fold
for @Gabriel439'sfoldl
package I stumbled upon this interesting inconsistency (full example here),Given that empty strings are a bit special as they indicate the end of the stream it's not entirely clear that this is a bug but it is quite surprising. Why does the initial empty string affect the resulting parse? Is this considered buggy behavior?
The text was updated successfully, but these errors were encountered: