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.
This PR does two things:
Details
More granular macros
This PR builds on the changes from PR #194. With PR #194, there are three specific ways in which non-strict mode diverges from RFC 8259:
{}[],:"
).\x01
-\x1F
) and invalid escape sequencesSome projects using jsmn might want some of these features, but not all. For example, a project might want to enable (1) to improve performance or shrink code size, but leave (3) disabled to help catch bugs.
For this purpose, this PR creates three new macros:
JSMN_PERMISSIVE_PRIMITIVES
for (1),JSMN_PERMISSIVE_STRINGS
for (2), andJSMN_PRIMITIVE_KEYS
for (3). These can be defined individually, or definingJSMN_NON_STRICT
will cause all to be defined.Enable strict mode and parent links by default
With this PR, strict RFC 8259 compliance and parent links become the default behavior. New macros
JSMN_LOW_MEMORY
andJSMN_NON_STRICT
disable these behaviors.JSMN_PARENT_LINKS
still exists, but is defined by default unlessJSMN_LOW_MEMORY
is defined.JSMN_NON_STRICT
replacesJSMN_STRICT
. When defined, all non-strict features are enabled.