Daniel Lemire
374de826ab
This introduces a reset functionality for object and array containers ( #1639 )
...
* This introduces a reset functionality.
* Minor simplification.
* Tweaking further.
* This should fix the tests.
2021-06-26 11:33:37 -04:00
Daniel Lemire
1fd3e32051
Removes is_at_container_start() and documents is_at_iterator_start(), move_at_start(), enter_at_container_start() ( #1638 )
...
* Removes is_at_container_start() and documents is_at_iterator_start()
* More documentation.
2021-06-25 13:26:43 -04:00
Daniel Lemire
16e8db1f17
Adding 'count_elements' method. ( #1577 )
...
* Adding 'count_elements' method.
* Actually reporting errors.
* removing white space.
* Removing white space again.
* Adding an extra example.
* Prettier.
* Making the functionality more error-proof.
* Avoiding exceptions.
* Various fixes including extending count_elements to value types.
* Various fixes.
* Minor fixes.
* Correcting comment.
* Trimming white spaces.
2021-06-06 17:56:00 -04:00
Daniel Lemire
19c3b1315a
Rewind functionality. ( #1539 )
...
* Rewind functionality.
* Keeping just the document rewind.
2021-06-04 09:22:33 -04:00
Daniel Lemire
1032f70ddf
Verifies and fixes issue 1588 ( #1589 )
...
* Verifies and fix issue 1588
* Removing a trailing space.
2021-05-27 19:35:42 -04:00
Daniel Lemire
4fb09824bf
Restricting how we can end key searches ( #1575 )
...
* Verifies bug with missing keys.
* Allowing search from any key.
* Workaround for buggy msys
* Restricting how we can end key searches.
* Adding a few tests.
2021-05-20 16:23:38 -04:00
John Keiser
2ed24666b5
Add value.type()
2021-03-02 17:02:50 -08:00
John Keiser
bcab8d3abf
Check for end object/array at top level
...
This avoids a very unlikely buffer overrun that can occur in a particular kind of invalid JSON:
- the document is invalid with an unclosed top level array or object
- the last thing in the document is a number that ends at EOF
- the padding is filled entirely with numeric digits
2021-02-22 09:35:21 -08:00
John Keiser
0634958329
Don't emit out of order iteration error for empty array
2021-02-21 11:43:36 -08:00
John Keiser
b352b903e7
Fix bug where iterators didn't always report errors
2021-02-21 11:43:36 -08:00
John Keiser
22b3ea93a8
Emit an error if user tries to iterate arrays out of order
2021-01-26 20:00:19 -08:00
John Keiser
e6d2b7759a
Fix assertion when getting array after failing to get a scalar
...
Also remove distinction between & and && for array start, acting like
other types
2021-01-26 14:09:54 -08:00
John Keiser
3279c2f15b
Remove unnecessary "try_get_XXX" methods
...
Also don't distinguish between & and && (instead, advance the first time
you encounter a scalar no matter what)
2021-01-11 15:19:26 -08:00
John Keiser
38da15b501
Rename checkpoint() -> position(), add token_position type
2021-01-11 15:19:24 -08:00
John Keiser
0f515785c6
Support reading scalars out of order
2021-01-11 15:17:46 -08:00
John Keiser
195acc3e45
Add find_field / find_field_unordered to object
2020-12-20 11:39:50 -08:00
John Keiser
d670906ff3
Don't keep a separate at_start boolean in object
2020-12-15 11:29:31 -08:00
John Keiser
f9c6dedca1
Add test for out-of-order parse asserts
2020-12-13 13:39:47 -08:00
John Keiser
73c7b7db3d
Safety: check index of scalar values before use
2020-12-11 11:57:09 -08:00
John Keiser
db6bf15361
Allow all array/object/etc. to be copied
2020-12-06 16:29:53 -08:00
John Keiser
3aa3175378
Add tests for recovering from partial child iteration
2020-12-06 16:19:06 -08:00
John Keiser
c89647af9e
Make all values use same underlying iterator
2020-12-06 15:23:52 -08:00