Skip to content
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

In-place parsing mode and unit-tests #25

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

demartinofra
Copy link

I added the following features to the library (mostly related to event based parsing mode) and since they are backward compatible with the current library API I thought it might be a good idea to merge them into upstream:

  • In-place parsing mode: memory utilization required by the library does not depend anymore on the input sequence. The input buffer is leveraged to execute in-place parsing and no extra memory is allocated for this.
  • Partial data callbacks: this is more like a requirement needed to implement in-place parsing mode. When this is enabled, the parser doesn't keep any internal buffer across two consecutive invocations of the parser function.
  • Support for Catch framework and unit-tests: added unit tests by using Catch test framework
  • Very small refactoring.

To Do:

  • Documentation needs to be updated in case you decide to merge these features.

Cheers,
Francesco

As per the previous implementation an event related to the parsing
of a primitive value was raised only when the comma separator was encountered.
With the new implementation the event is raised as soon as the
parsing of the value is completed
In some edge cases, namely when a number immediatly preceeds a closing
bracketi, the parser (in IN_PLACE mode) was returning the wrong position of the
buffer on close array/object events. The events sequence was correctly
produced though.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant