-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add known upper limit to capture search.
The DFA will report the end location of a match, so we should pass that along to capture detection. In theory, the DFA and the NFA report the same match locations, so this upper bound shouldn't be necessary---the NFA should quit once it finds the right match. It turns out though bounding the text has two important ramifications: 1. It will enable the backtracking engine to be used more often. In particular, the backtracking engine can only be used on small inputs and this change decreases the size of the input by only considering the match. 2. The backtracking engine must start every search by zeroing memory that is proportional to the size of the input. If the input is smaller, then this runs more quickly. We are also careful to bound the match to one additional "character" past the end of the match, so that lookahead operators work correctly.
- Loading branch information
1 parent
4471212
commit 7084f14
Showing
2 changed files
with
31 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters