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

Track the stream offset during parsing. #16

Merged
merged 1 commit into from Jan 9, 2014

Conversation

rubenv
Copy link
Contributor

@rubenv rubenv commented Jan 9, 2014

This makes it possible to write a module based on jsonparse that maps a position in a string to a datamember of the json object (that one is coming soon).

The unit test tests the following things:

  • Objects
  • Arrays
  • Strings
  • Numbers (positive, negative, fractions)
  • Booleans
  • Nulls
  • Unicode (note the д).

Not tested (full disclosure): exponents. But I'm fairly confident that they will work.

@rubenv
Copy link
Contributor Author

rubenv commented Jan 9, 2014

One improvement to this would be to change onToken so that it also accepts an offset and a length field parameter, rather than having to pull the offset from the parser in a custom onToken implementation.

Let me know if you'd like that instead.

creationix added a commit that referenced this pull request Jan 9, 2014
Track the stream offset during parsing.
@creationix creationix merged commit ca7ac16 into creationix:master Jan 9, 2014
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.

None yet

2 participants