Skip to content

Optional leading plus sign not included in textual value of any integral nor all floating-point numbers #784

Closed

Description

@cowtowncoder

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.

Activity

  1. 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
  2. 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
  3. cowtowncoder commented on Jun 28, 2022

    @cowtowncoder
    MemberAuthor

    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.

  4. cowtowncoder commented on Jun 29, 2022

    @cowtowncoder
    MemberAuthor

    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.

  5. cowtowncoder commented on Nov 7, 2025

    @cowtowncoder
    MemberAuthor

    Current thinking: getText() should faithfully reproduce input token -- so leading plus, even if non-standard, should be included.

  6. added a commit that references this issue on Nov 7, 2025
    a713c8c
  7. added this to the 3.1.0 milestone on Nov 7, 2025
  8. added a commit that references this issue on Nov 7, 2025
    cf1df5e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions