Adds a safe pure-Rust implementation of Lua's pattern matching, ported from PRLua. The implementation has been modified to be non-recursive and manually manage a stack for backtracking, and yields back to the executor every so often to prevent hanging on pathological patterns.
This does not yet handle consuming fuel, but it would be straightforward to add, as it can already yield back to the executor.
This currently has three different implementations of the pattern matching engines; one recursive, one sequential, and one built using the async sequence API to allow yielding. The recursive impl is the theoretical fastest (though it has issues with fragile optimizations), but it can't handle yielding to the executor, so it can't be used on untrusted input. I'll likely prune the alternate implementations, but leave them available somewhere if they might be useful for running trusted patterns.
I'm still working on cleaning this up, but it's usable in its current state.
This adds a dependency on memchr for string searching.
(right now it also has an optional dep on no-panic, but I plan to remove it.)
Adds a safe pure-Rust implementation of Lua's pattern matching, ported from PRLua. The implementation has been modified to be non-recursive and manually manage a stack for backtracking, and yields back to the executor every so often to prevent hanging on pathological patterns.
This does not yet handle consuming fuel, but it would be straightforward to add, as it can already yield back to the executor.
This currently has three different implementations of the pattern matching engines; one recursive, one sequential, and one built using the async sequence API to allow yielding. The recursive impl is the theoretical fastest (though it has issues with fragile optimizations), but it can't handle yielding to the executor, so it can't be used on untrusted input. I'll likely prune the alternate implementations, but leave them available somewhere if they might be useful for running trusted patterns.
I'm still working on cleaning this up, but it's usable in its current state.
This adds a dependency on
memchr
for string searching. (right now it also has an optional dep onno-panic
, but I plan to remove it.)