Update formatting branch from #67#82
Merged
Merged
Conversation
JSONStandardFormatter which will format using indentation and newlines. Migrated all unittests. Fix a couple of bugs in parser/serializer that were found when getting all tests to pass.
Owner
Author
|
Note, formatjson is no longer valid, I have to rework that with the new API. |
Contributor
Closed
and state machine.
Owner
Author
|
Ready to merge this, then work on updating the serializer to use this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@gulugulubing I reworked how the formatter works.
This is essentially your branch, but I divided the abstraction into two types.
JSONOutputterwhich only is concerned with outputting valid JSON/JSON5, not caring about spacing.JSONStandardFormatterwhich implements formatting options as we discussed.The idea is to make the formatter code simple, while relying on the state machine in
JSONOutputterto do all the heavy lifting.Note that I implemented the entire state machine for JSON (including colons and commas) this is necessary so the spacing can properly be implemented from a higher-level type. It made the logic a bit easier to write as well.
This still isn't finished, I think there are some API pieces to write. And of course, the serialize function family should use the formatter.
I'm thinking we can close #67 if you are ok with it? Let me know.