Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.)