Skip to content

parse flag - #78

Open
WindSoilder wants to merge 5 commits into
push-rpwmqxtyyxkufrom
parse_flag
Open

parse flag#78
WindSoilder wants to merge 5 commits into
push-rpwmqxtyyxkufrom
parse_flag

Conversation

@WindSoilder

Copy link
Copy Markdown
Contributor

NOTE: it's based on #74, please do not review this before it.

This pr implement flag parsing in both definition and applying, for example:

def foo-with-flag [--bar: int = 3, --baz(-b), x, y: int] { [$bar, $baz, $x, $y] }
foo-with-flag --baz

To make it easiler to do resolving and typechecking, I splitted AstNode::Param into AstNode::PosParam and AstNode::FlagParam.

It also adresses the following:

allow custom command name contains dash(-), it's done by making call_name to return a list of berewords, which invokes identifier_allow_dash, it's one-to-one map to call_name and IDENTIFIER_ALLOW_DASH rules in grammar.md.
allow defining default parameter for flag and parameter, it's also one-to-one map to flag_parameter and partial positional_parameter.
allow calling command with spread operator

What's done next:

support rest_parameter definition
support option_parameter definition
support custom_completion definition

Stack created with GitHub Stacks CLIGive Feedback 💬

@WindSoilder
WindSoilder added this pull request to stack #80 September 10, 2026 09:23
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.

1 participant