You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Optional leading plus sign not included in textual value of any integral nor all floating-point numbers #784
Implementation of #774 is mostly complete, but there is one minor inconsistency: whereas leading plus sign -- if (and only if) enabled as non-standard feature -- is retained for some floating-point numbers when accessing token with JsonParser.getText() (and related), it is not retained for any of integral numbers (nor all FPs).
The underlying problem to solve is that of assumptions based on there only ever being a leading minus sign in TextBuffer (or shared input buffer): something that made sense before allowing non-standard leading plus.
changed the title [-]Optional leading plus sign not included in textual value of integral numbers[/-][+]Optional leading plus sign not included in textual value of integral numbers (and possibly some floats)[/+]on Jun 28, 2022
changed the title [-]Optional leading plus sign not included in textual value of integral numbers (and possibly some floats)[/-][+]Optional leading plus sign not included in textual value of any integral nor all floating-point numbers[/+]on Jun 28, 2022
Ok, so: currently non-standard plus (+) is never included in text returned. This is different from other deviations, partly since they are omissions (lack of leading 0, or trailing digit after decimal comma).
I guess comparison could be to leading zeroes, handling of which (in non-standard) mode I don't actually know.
But if they are not exposed we could even consider current behavior as the expected way (leave out non-standard characters). Have to think more about this -- then again it will take some effort to retain plus sign anyway so there is no urgency.
Activity
[-]Optional leading plus sign not included in textual value of integral numbers[/-][+]Optional leading plus sign not included in textual value of integral numbers (and possibly some floats)[/+]Minor test changes prepping for #784
[-]Optional leading plus sign not included in textual value of integral numbers (and possibly some floats)[/-][+]Optional leading plus sign not included in textual value of any integral nor all floating-point numbers[/+]cowtowncoder commentedon Jun 28, 2022
Come to think of this, one option is to remove leading plus sign from all cases, instead of trying to add it.
This is not ideal but is possible.
cowtowncoder commentedon Jun 29, 2022
Ok, so: currently non-standard plus (
+) is never included in text returned. This is different from other deviations, partly since they are omissions (lack of leading0, or trailing digit after decimal comma).I guess comparison could be to leading zeroes, handling of which (in non-standard) mode I don't actually know.
But if they are not exposed we could even consider current behavior as the expected way (leave out non-standard characters). Have to think more about this -- then again it will take some effort to retain plus sign anyway so there is no urgency.
cowtowncoder commentedon Nov 7, 2025
Current thinking:
getText()should faithfully reproduce input token -- so leading plus, even if non-standard, should be included.Fix #784: retain leading plus sign
Fix FasterXML#784: retain leading plus sign (FasterXML#1508)
Add JsonReadFeature.ALLOW_HEXADECIMAL_NUMBERS for JSON5-style hex lit…
Add JsonReadFeature.ALLOW_HEXADECIMAL_NUMBERS for JSON5-style hex lit…