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

feat(JSON): accept int_lit & float_lit numbers as defined in go spec #185

Merged
merged 1 commit into from
Jan 5, 2022

Conversation

maxatome
Copy link
Owner

@maxatome maxatome commented Jan 3, 2022

The following numbers are now accepted by JSON, SuperJSONOf and
SubJSONOf operators:

    +42          → 42
    4_2          → 42
    0b101010     → 42
    0b10_1010    → 42
    0600         → 384
    0_600        → 384
    0o600        → 384
    0O600        → 384 // second character is capital letter 'O'
    0xBadFace    → 195951310
    0x_Bad_Face  → 195951310
    .25          → 0.25
    1_5.         → 15.0
    0.15e+0_2    → 15.0
    0x1p-2       → 0.25
    0x2.p10      → 2048.0
    0x1.Fp+0     → 1.9375
    0X.8p-0      → 0.5
    0X_1FFFP-16  → 0.1249847412109375

The following numbers are now accepted by JSON, SuperJSONOf and
SubJSONOf operators:
    +42          → 42
    4_2          → 42
    0b101010     → 42
    0b10_1010    → 42
    0600         → 384
    0_600        → 384
    0o600        → 384
    0O600        → 384 // second character is capital letter 'O'
    0xBadFace    → 195951310
    0x_Bad_Face  → 195951310
    .25          → 0.25
    1_5.         → 15.0
    0.15e+0_2    → 15.0
    0x1p-2       → 0.25
    0x2.p10      → 2048.0
    0x1.Fp+0     → 1.9375
    0X.8p-0      → 0.5
    0X_1FFFP-16  → 0.1249847412109375

Signed-off-by: Maxime Soulé <btik-git@scoubidou.com>
@coveralls
Copy link

Coverage Status

Coverage increased (+0.0003%) to 99.853% when pulling d3543c8 on json++ into 4e544bd on master.

@maxatome maxatome merged commit 4aa5af6 into master Jan 5, 2022
@maxatome maxatome deleted the json++ branch January 5, 2022 07:36
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.

None yet

2 participants