-
Notifications
You must be signed in to change notification settings - Fork 196
Open
Milestone
Description
I noticed that we're generating unnecessary cursor restores for or in some cases.
The simplest example is probably:
'a' or 'b'
K_needed() reports that this can change the cursor - that's true (because 'a' moves the cursor if it matches) but for generating the or itself what actually matters is if a clause can move the cursor and fail. That's still possible, e.g. we do need to restore the cursor if the first clause fails here:
('a' 'a') or 'b'
However there are a lot of common cases that can't change the cursor on failure - e.g. an or clause which is a single literal string or grouping.
We should also be checking this per-clause (currently we restore after every clause or after none).
Metadata
Metadata
Assignees
Labels
No labels