This repository has been archived by the owner on Mar 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 613
Partial parsing #88
Open
canatella
wants to merge
12
commits into
dropbox:master
Choose a base branch
from
canatella:partial-parsing
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Partial parsing #88
Commits on Jan 6, 2017
-
Configuration menu - View commit details
-
Copy full SHA for 166371b - Browse repository at this point
Copy the full SHA 166371bView commit details -
Differenciate end of input failures from other failures.
For partial input parsing, we need to know when failure is caused by missing data so that we can retry parsing later when we have more data. This commit adds a need_data boolean flag alongs the failed one. It adds a stop function to set that flag and propagate the failure. It replaces checks for failure with a check on both failed and need_data flags. It also adds a eos function to check for end of input. It also replaces the fail calls due to end of input by stop calls.
Configuration menu - View commit details
-
Copy full SHA for 55f568f - Browse repository at this point
Copy the full SHA 55f568fView commit details -
Make json object stack explicit.
As of now, the program stack is implicitly used to build the json object tree. For partial parsing support, we cannot use the program stack as parsing can be called at anytime. This commit adds a values stack and uses it to transmit value back along the object tree. All parsing functions now return void and instead pushes their result on the stack. The functions needing the result of other parsing functions (mostly for arrays and objects) read values from the stack and pop them.
Configuration menu - View commit details
-
Copy full SHA for cd6e3a9 - Browse repository at this point
Copy the full SHA cd6e3a9View commit details -
Use value stack for checking maximum depth.
As we now have an explicit stack, we don't need the depth variable argument to count the recursion levels. We can simply use the value stack size instead.
Configuration menu - View commit details
-
Copy full SHA for 1771606 - Browse repository at this point
Copy the full SHA 1771606View commit details -
Split json value parse function.
For partial support, when continuing parsing, we need to restart in the same state as we left. For that, we need to skip some actions if they were already done. Left as is, the code would be littered with ifs so refactor the parse_json function into multiple function, one per type of objects.
Configuration menu - View commit details
-
Copy full SHA for 4cbea0b - Browse repository at this point
Copy the full SHA 4cbea0bView commit details -
Add explicit state management.
For partial parsing support, we need to remember what we were doing so that we can continue parsing. This commit adds an enum with all our parsing states and a states stack to store the current states.
Configuration menu - View commit details
-
Copy full SHA for 4e0e31c - Browse repository at this point
Copy the full SHA 4e0e31cView commit details -
Store builded object on the stack.
For partial building, we need to temporary store the object being build as we maybe interrupted. This commits change object and array parsing to use the values stack has a temporary place for storing the object being build.
Configuration menu - View commit details
-
Copy full SHA for c9d9436 - Browse repository at this point
Copy the full SHA c9d9436View commit details -
For parsing partial json, we need to be able to restart parsing from a valid position in the input stream. This commit stores the current position when switching state and restores it when more data is needed so that when parsing again, the parser restarts at the right position.
Configuration menu - View commit details
-
Copy full SHA for 44d93d8 - Browse repository at this point
Copy the full SHA 44d93d8View commit details -
Implement partial parsing support.
This commit implements a consume method that takes a chunk of json, append it to the current data and parses it.
Configuration menu - View commit details
-
Copy full SHA for ab45c17 - Browse repository at this point
Copy the full SHA ab45c17View commit details -
Configuration menu - View commit details
-
Copy full SHA for e6b1df6 - Browse repository at this point
Copy the full SHA e6b1df6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5ea3854 - Browse repository at this point
Copy the full SHA 5ea3854View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7d97cfc - Browse repository at this point
Copy the full SHA 7d97cfcView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.