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

parse all edge cases of ints and floats #315

Merged
merged 3 commits into from
Jul 17, 2024
Merged

parse all edge cases of ints and floats #315

merged 3 commits into from
Jul 17, 2024

Conversation

lbialy
Copy link
Contributor

@lbialy lbialy commented Jul 16, 2024

closes #222

@lbialy lbialy requested a review from tgodzik July 16, 2024 13:26
.map(ConstructError.from(_, "Long", s))
}

private val infinityRegex = """([-+]?)(\.inf|\.Inf|\.INF)""".r
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a regex? toLowerCase.endsWith etc. wouldn't be enough here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to spec .INf is not a validInfinity :[

also it would be something like:

if value.nonEmpty then
  if value(0) == '-' then
    if value(1) == '.' then
      if value(2) == 'i' || value(2) == 'I' ...

which is basically the same thing as what regex would do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sure, that was just a nitpick

@lbialy lbialy merged commit 96e1864 into main Jul 17, 2024
6 checks passed
@lbialy lbialy deleted the issue-222 branch July 17, 2024 09:25
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.

Hexadecimal values or .inf fails to get parsed
2 participants