StractOrg / stract

web search done right
https://stract.com
GNU Affero General Public License v3.0
1.94k stars 43 forks source link

Allow multiple match statements within an optic rule #127

Closed SekoiaTree closed 4 months ago

SekoiaTree commented 4 months ago

Current state: draft

Missing

This PR makes it much easier to make large sets of rules with repeated actions. Rules can now have several Matches blocks. This allows Rules to essentially be an OR of several ANDs, i.e. https://en.wikipedia.org/wiki/Disjunctive_normal_form, which is much more flexible and clear. https://github.com/StractOrg/sample-optics/blob/main/10k_short.optic rewritten to use this feature would take ~256 KiB less (though that's quite an extreme example).

SekoiaTree commented 4 months ago

Using the above pull request, parsing tests are complete. Combined with the verification test that was already modified, I think this PR is ready for merge.