fix(number): allow float prefixes before non-exponent text - #1889
Open
sb123sb123 wants to merge 1 commit into
Open
sb123sb123 wants to merge 1 commit into
sb123sb123 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1725
Cause
The optional exponent parser uses
cut(digit1)after consumingeorE. When that character starts ordinary trailing text, as in123episode, the digit parser returns a fatal error instead of allowing the optional exponent to be skipped. The valid prefix123is therefore rejected.Fix
Keep the cut behavior when an exponent reaches end-of-input, preserving the existing malformed/incomplete exponent behavior. When non-digit trailing input follows
eorE, let the optional exponent backtrack. Apply the same parser change to complete, streaming, and mode-generic float recognizers.Validation
cargo +nightly test --offline -p nom— passed (208 library tests; all package integration tests and doctests passed).cargo +nightly test --offline -p nom --no-default-features— passed (324 doctests).cargo +nightly test --offline -p nom --no-default-features --features alloc— passed (324 doctests).cargo +nightly test --offline -p nom --features std— passed (324 doctests).cargo +nightly test --offline -p nom --no-default-features --features alloc,std— passed (324 doctests).cargo +nightly build --offline -p nomand the minimalalloc,stdbuild — passed.cargo +nightly fmt --all -- --check— passed.cargo +nightly bench --offline --features ""— passed.Ok(("episode", "123")); the same reproducer on the base commit returnedErr(Failure(... code: Digit)).cargo test --offline --lib float_test(3 passed) andcargo test --offline --test float(6 passed).Baseline limitations
The exact workspace test and documentation commands cannot complete on this Windows host because the unrelated
benchmarksmember'sjemalloc-sysbuild reports “C compiler cannot create executables” (exit 77). Package documentation withRUSTDOCFLAGS=-D warningsalso encounters existingrustdoc::redundant-explicit-linkswarnings insrc/combinator/mod.rs. Beta and 1.65 toolchains were not installed, and stable Cargo was removed by a concurrent host job after the focused checks. These limitations are unrelated to this patch.AI assistance disclosure
This PR was developed with autonomous GPT-5.6 assistance. Issue triage, reproduction, implementation, validation, diff inspection, commit signing, and submission were performed by the agent in the remote workspace.