Skip to content

fix: consume separate negative numeric flag values - #37

Open
xiehuanyi wants to merge 1 commit into
lukeed:masterfrom
xiehuanyi:fix-separated-negative-numbers
Open

xiehuanyi wants to merge 1 commit into
lukeed:masterfrom
xiehuanyi:fix-separated-negative-numbers

Conversation

@xiehuanyi

Copy link
Copy Markdown

Separate negative numeric values currently become flags: mri(['--n', '-5']) returns { _: [], n: true, '5': true }, while --n=-5 already works. The lookahead now consumes a negative token when it passes the same numeric coercion used for flag values.

Regression coverage includes short and long flags, fractions, exponent notation, string/boolean options, and a following flag or -- terminator. npm test fails 11 assertions before the fix and passes all 97 assertions after it.

Fixes #36.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 11:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Negative number as separate value is parsed as flags (--n -5 -> { n: true, 5: true })

2 participants