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

Frugal Operators #257

Open
Aphexus opened this issue Oct 24, 2018 · 0 comments
Open

Frugal Operators #257

Aphexus opened this issue Oct 24, 2018 · 0 comments

Comments

@Aphexus
Copy link

Aphexus commented Oct 24, 2018

Is there any way to simplify having to qualify greedy operators so a proper match occurs:

.* <--- Matches everything
.* 'x' <--- Matches everything 'x' is pointless as .* consumes all x's
(!'x' .)* <--- qualified to only match on non-'x'

The qualification is necessary but overcomplicates things.

It would be nice if one could write

.* 'x'

and the next rule(group if or'ed) is checked automatically.

This is a common occurrence because most greedy matches have some type of termination(e.g., "'s for strings, brackets for arrays, etc).

If Pegged can't do this easily maybe a new operator symbol could be created to handle it?

.** 'x'

would match all characters and terminating when 'x' is found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants