Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is two separate number parsing bug fixes:
Do not skip leading whitespace in
jvp_strtod
jvp_strtod
skips leading whitespace, but its decnum counterpartdecNumberFromString
(called withinjv_number_with_literal
) does not. Those two are called interchangeably, so it leads to inconsistent behavior depending on whether the decnum feature is enabled. Additionally,classify
, used in the token scanner, only considers[ \t\n\r]
to be whitespace, butjvp_strtod
consumes the larger set[ \t\n\v\f\r]
, so those extra characters are considered literals.Commit ce0e788 (improve tonumber/0 performance by parsing input as number literal, 2024-03-02) changed
tonumber
to not accept leading or trailing whitespace. However, this case was missed.Changing this deviates from the behavior of
strdod
from <stdlib.h> and is technically a breaking API change, since it is a public symbol.Handle input errors for --indent
Handle malformed and overflowing arguments. Also, forbid leading and trailing spaces to match the behavior of
tonumber
.This will produce a merge conflict in conjunction with PR#3194 Parse short options in order given, because they modify the same area. However, they are logically independent and can be merged in either order. After the first merge, I will rebase the second onto the first.Done