Open mofeing opened 10 months ago
notes for self when I get to this:
do
notation for writing folds directly into the grammar, as with bisonflex
. I'd suggest that for simplifying matters we do 2 helper functions, one if these regex_to
(scans everything to the match, including the match) and second regex_before
(scans everything to the match without the match), with an optional argument to select which match group is actually being selected. (Can be done by taking .offset
and .ncodeunits
from m.match
or m.captures[N]
.)
Proposal
Often I find myself that some clauses are more easily parsed with a regex than with PikaParser clauses. The solution is to user a
Scan
in a way similar to:It would be great if we could just pass the regex to
scan
.Unsolved issues
Only regex of the form
r"^..."
should be accepted. If the^
clause is not present, then the regex will search the pattern along all the input.