Open Aphexus opened 6 years ago
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.
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.