-
Notifications
You must be signed in to change notification settings - Fork 94
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
simplify parser #72
Comments
Don't think it is a simplification. User will need to keep an addition state - the last write result. |
Off topic: |
Users have to observe that anyway, since they need to check the error code. 99% of users don't care about processing additional data which lies past the JSON, so this is certainly a simplification. We still get the same features but with fewer functions. Having the proliferation of functions was confusing. To be clear consider this input string: There is a JSON followed by something that isn't a JSON. The parser can handle this, it will simply return 12 indicating that 12 characters were consumed, and the error will be set to |
What about truncated input? Like: "{ a: ...." // ok |
I don't understand the question here. "{ a: ..." is not valid JSON, the key needs to be a string (i.e. in double quotes). If you can write out exactly what is in each buffer, that would be helpful. For example consider this json:
This produces an array which serializes to the string We can parse this in two buffers thusly:
A number however, needs a call to finish:
If the end of the buffer is indicated (from a call to
|
How to correctly process this without |
I only removed one overload of |
Ah... Ok, undestand now.
sounded too radical for me :-) |
Heh, I should have been more clear. Note, that there were previously eight member functions (2 each of write_some, write, finish, and finish, one for errors and one for exceptions). |
This is done |
we dont need all the extra overloads of
finish()
, we can just makewrite
work likefinish
and the user can deal with the error if they want to continue processing the extra data.The text was updated successfully, but these errors were encountered: