Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positional arguments within repeatable group are blocked in 2nd iteration #79

Open
Ext3h opened this issue Oct 16, 2024 · 0 comments
Open

Comments

@Ext3h
Copy link

Ext3h commented Oct 16, 2024

Consider the following grammar:

repeatable(
	required("--begin-group-a")
	&
	(
		option("--conflicting-group-option")
	)
)
|
repeatable(
	required("--begin-group-b")
	&
	(
		option("--conflicting-group-option")
	)
)

When trying to parse any of --begin-group-a --begin-group-a, --begin-group-a --conflicting-group-option --begin-group-a or any other input that would require more than one iteration, the second and following instances of --begin-group-a are always rejected as [blocked].

We can simplify this down to the following and the bug remains reproducible:

repeatable(
	required("--begin-group-a")
	&
	option("--conflicting-group-option")
)

Simplified even further:

repeatable(
	required("--begin-group-a").blocking(true)
	,
	option("--conflicting-group-option")
)

Reducing it to a single element within the repeatable group does not trigger the bug:

repeatable(
	group(
		required("--begin-group-a").blocking(true)
	).scoped(true)
)

--begin-group-a --begin-group-a is accepted.


Trying to avoid blocking arguments looks like it would work, but actually doesn't:

repeatable(
	required("--begin-group-a")
	,
	(
		option("--conflicting-group-option")
	)
)
|
repeatable(
	required("--begin-group-b")
	,
	(
		option("--conflicting-group-option")
	)
)

--group-option-a --conflicting-group-option --begin-group-a gives an unavoidable [conflict] on --conflicting-group-option.

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

No branches or pull requests

1 participant