Skip to content

[core] Add allow_negative_expressions() method for Command#48

Merged
forfudan merged 5 commits intomainfrom
expr
Apr 10, 2026
Merged

[core] Add allow_negative_expressions() method for Command#48
forfudan merged 5 commits intomainfrom
expr

Conversation

@forfudan
Copy link
Copy Markdown
Owner

@forfudan forfudan commented Apr 10, 2026

This PR adds a new Command.allow_negative_expressions() mode to treat dash-prefixed mathematical expressions (and similar tokens) as positional arguments, expanding ArgMojo’s handling of “negative-looking” inputs beyond numeric literals.

Changes:

  • Introduce _allow_negative_expressions flag + allow_negative_expressions() builder on Command.
  • Add parsing logic to consume certain -... tokens as positionals in both parse_arguments() and parse_known_arguments().
  • Add documentation and tests describing/validating the new behavior.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Command.allow_negative_expressions() mode to treat dash-prefixed mathematical expressions (and similar tokens) as positional arguments, expanding ArgMojo’s handling of “negative-looking” inputs beyond numeric literals.

Changes:

  • Introduce _allow_negative_expressions flag + allow_negative_expressions() builder on Command.
  • Add parsing logic to consume certain -... tokens as positionals in both parse_arguments() and parse_known_arguments().
  • Add documentation and tests describing/validating the new behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/test_parse.mojo Adds test cases for negative-expression passthrough behavior.
src/argmojo/command.mojo Implements the new command flag, parsing rules, and help-tip adjustments.
docs/user_manual.md Documents the new approach and compares it to existing mechanisms.
docs/declarative_api_planning.md Notes the feature as builder-only/imperative parser behavior.
docs/changelog.md Adds an unreleased changelog entry for the new feature.
docs/argmojo_overall_planning.md Updates the parsing algorithm planning notes to include the new rule.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@forfudan forfudan merged commit a3ccfcd into main Apr 10, 2026
5 checks passed
@forfudan forfudan deleted the expr branch April 10, 2026 22:16
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.

2 participants