Skip to content

Require end-of-input to be reached for range-based parser invocations #808

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

Merged
merged 6 commits into from
Mar 26, 2020

Conversation

dominiklohmann
Copy link
Member

@dominiklohmann dominiklohmann commented Mar 25, 2020

Motivation: We use a custom-made parser-combinator framework for high-performance parsers in VAST, and to combine parsers one needs to be able to resume parsing after partial consumption of input. Experience has shown (e.g., #791) that we don't usually want to silently discard input on the resulting, combined parsers.

Before the change implemented by this PR, EOI checks were required to be done manually by the caller, e.g. by calling (p >> eoi)(rng, attr) over p(rng, attr). Outside of combining with the eoi parser, there was no way to verify whether the EOI was reached successfully for range-based parser invocations. This has turned out to be very error prone.

For [begin, end)-iterator based invocations, nothing changes. It is easy for the caller to verify whether the EOI was reached successfully by simply comparing begin and end.

Among other things, this PR completely disables the MRT integration, which we knew to be broken, but which silently succeeded in parsing invalid data. It will be revisited at a later point in time.

@dominiklohmann dominiklohmann added the bug Incorrect behavior label Mar 25, 2020
@dominiklohmann dominiklohmann force-pushed the story/ch6678 branch 2 times, most recently from 417182d to 157fbd5 Compare March 25, 2020 12:18
@dominiklohmann
Copy link
Member Author

dominiklohmann commented Mar 25, 2020

End result:

  • CSV map parser is broken; test has been disabled.
  • MRT integration is broken; has been removed (for now). This was known to be broken, it just never failed in the tests.
  • A whole bunch of parsers were fixed by the second commit, which strips the NUL byte from parser invocations using a known-length char array. This mostly affected our test suite.

@dominiklohmann dominiklohmann marked this pull request as ready for review March 25, 2020 13:32
@dominiklohmann dominiklohmann requested a review from a team March 25, 2020 13:58
Copy link
Member

@tobim tobim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I'm surprised there are not more breaking tests.

@dominiklohmann dominiklohmann merged commit b993d3c into master Mar 26, 2020
@dominiklohmann dominiklohmann deleted the story/ch6678 branch March 26, 2020 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants