Version 1.2.0#9
Open
tilo wants to merge 5 commits into
Open
Conversation
…se tests
Null and NULL join null / None / undefined as recognized spellings of nil
(SQL / R / PHP var_export / YAML / DB-derived input), in BOTH the C extension
and the pure-Ruby parser, in every position the existing spellings work
(top-level, object value, array element). Quoted ("NULL") and embedded
(NULL Island) forms stay strings. Uppercase TRUE/FALSE intentionally NOT added
(thin precedent: PHP/SQL emit lowercase/numeric booleans; only R uses uppercase).
Also adds the corner-case tests discussed: NaN/Infinity (real Float objects,
+Infinity, array elements) and recognized-literal classification boundaries
(quoted stays string; wrong-case stays string).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ring A leading-zero token now reads as a number when it carries a sign, a decimal point, or an exponent (+007 -> 7, -000023.5 -> -23.5, 00.0 -> 0.0, 007e2 -> 700.0). A bare leading-zero integer (000001, 02) still reads as a string, so IDs, zip codes, and account numbers keep their zeros. C path: fj_try_decimal (quoteless/container) and fj_parse_number (strict/top-level) consume leading zeros and reject a bare leading-zero integer. Ruby path: DEC_RE admits leading zeros, numeric_value returns the string for a bare leading-zero integer, parse_number raises at top level. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eparator A token like 0_0.5 is 00.5 once the underscore separator is removed, so it should parse as a number (the dot signals numeric intent) — and identically on the C and Ruby paths, in containers and at the top level. The C scanners diverged: their leading-'0' branch entered its digit run-loop only on a digit, not on '_', so 0_0.5 / 0_0e5 stayed strings (C) while the Ruby container path already parsed them as numbers. The top-level path raised on both. All three scanners (fj_try_decimal, fj_parse_number, Ruby parse_number) now enter the run-loop on '_' too, matching the [1-9] branch; had_leading_zero is flagged only when a real digit is consumed, so a bare 0_0 / 0_07 still stays a string (raises at the top level). Defect in the unreleased 1.2.0 leading-zero work; never shipped, so no CHANGELOG change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9 +/- ##
=======================================
Coverage 99.83% 99.83%
=======================================
Files 7 7
Lines 1193 1208 +15
=======================================
+ Hits 1191 1206 +15
Misses 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- CHANGELOG: flag that leading-zero decimals/exponents previously read as strings (a String->Float change, not just a new capability), and add the `RSpec tests: 1,143` line to match the other entries. - Align the Null/NULL source list to "SQL / R / PHP / YAML" in README and docs/_introduction.md (CHANGELOG and the spec already say PHP). - Trim the now-redundant inner leading-zero comments in fj_try_decimal and fj_parse_number (the outer comment already explains the bare-rejection). No behavior change; 1143 examples, 0 failures. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
No description provided.