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

Add limitations to quantity parsing logic #7671

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

hl662
Copy link
Contributor

@hl662 hl662 commented Feb 7, 2025

Closes #7596

  • Improve tests, ensuring default parsing and formatting in core frontend's QuantityFormatter produces equivalent values between each other.
  • Update the tokenization logic, adding limits and document them in scenarios where a spacer conflicts with a math operator. In particular:
    • Mathematical operations only apply when it is in between whitespace. So -2FT 6IN + 6IN is equal to -2FT-6IN + 6IN, and -2FT-6IN - 6IN is not equal to -2FT-6IN-6IN.
    • For a value like 2FT 6IN-0.5, the - sign will be treated as a spacer and not subtraction. However, the 0.5 value will use the default unit conversion provided to the parser, because it's not a part of the composite unit when that composite is made up of only 2 units - FT and IN.

@hl662 hl662 self-assigned this Feb 7, 2025
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.

Default imperial units length parser does not accept string from default length formatter.
1 participant