swiftlang / swift-experimental-string-processing

An early experimental general-purpose pattern matching engine for Swift.
Apache License 2.0
278 stars 47 forks source link

[6.0] Remove most consumer functions #734

Closed natecook1000 closed 7 months ago

natecook1000 commented 7 months ago

Explanation: This change removes most uses of consumer functions in the regex processor, by implementing them as instructions instead. Scope: All the changes are internal implementation within the _StringProcessing module. Issue: n/a Original PR: #660 Risk: Low. There's no API or ABI impact of this change. Testing: This change adds compilation tests that verify that consumer functions are removed when appropriate, and uses the existing unit tests to verify no change in matching behavior. Reviewer: @stephentyrone


Original PR text: This is based heavily off the work in #590, rebased onto main, with some changes to remove even more consumer uses. Consumer functions only have two remaining uses: non-ASCII ranges and Unicode lookups (for things like general category, binary properties, name, etc.).

This change primarily treats custom character classes as alternations around their contents, with set operations emitted as instructions instead of implemented via consumer function.

natecook1000 commented 7 months ago

@swift-ci Please test