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

Feature/ jsonc #11

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Feature/ jsonc #11

wants to merge 11 commits into from

Conversation

Sykander
Copy link

@Sykander Sykander commented Mar 2, 2023

It'd be great if this project supported jsonc. :)

Changes

  • Added option jsonc which when set true will do the following:
  • Add support for jsonc containing code comments like // or /* ... */ (which is treated as whitespace)
  • Add support for jsonc containing trailing commas

Description of Changes

I added a new function called parseComment in the style of the other parseObject, parseArray, parseXXX functions, which reads through code comments as whitespace when jsonc option is enabled.

When called this function parses through the source until it finds a valid comment termination and then returns to the original whitespace function to continue parsing whitespace.

I also adjusted parseObject and parseArray to allow for trailing commas if and only if jsonc option is enabled.

- Added jsonc support
- Unit tests
Sykander added 10 commits March 3, 2023 00:02
- Add jsonc as a configurable option
- Updated readme for jsonc option
- jsonc allows trailing commas
- Updated test case output message
- Refactor read comments function
- Added additional unit tests for branch coverage
- test coverage
- code refactor
- Added test to make sure pointers were still working
- Added functionality for earlyCommas as well as trailing commas
- Cleaned up early commas and test cases
- Performance improvements
- fixed issue with column count and comments
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.

1 participant