-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
properly support lookahead expresions in begin matches #2135
Merged
joshgoebel
merged 10 commits into
highlightjs:master
from
joshgoebel:proper_lookahead_support
Oct 19, 2019
Merged
properly support lookahead expresions in begin matches #2135
joshgoebel
merged 10 commits into
highlightjs:master
from
joshgoebel:proper_lookahead_support
Oct 19, 2019
Commits on Oct 19, 2019
-
- begin matches are matched a single time (they no longer need to be rematched after found) - look-ahead should now work properly for begin matches because of this change - should be a tiny bit faster Before The old parser would build a list of regexes per mode and then combine that into a large regex. This is what was used to scan your code for matches. But after a match was found it had no way on known WHICH match - so it would then have to re-run all the rules sequentially on the bit of match text trying to figure out which rule had matched. The problem is while the original matcher was running agianst the full code this "rematch" was only running aginst the matched text. So look-ahead matches would naturally fail becasue the content they were tryign to look-ahead to was no longer present. After We take the list of regexes per mode and combine then into a larger regex, but with match groups. We keep track of which match group position correspond to which rule. Now when we hit a match we can check which match group was matched and find the associated rule/mode that was matched withotu having to double check. Look-ahead begin matches now "just work" because the rules are always running against the full body of text and not just a subset. Caveats This doesn't solve look-ahead for end matching so naturally it also does nothing for endSameAsBegin. IE, don't expect look-aheads to work properly in those situations yet.
Configuration menu - View commit details
-
Copy full SHA for aa957a7 - Browse repository at this point
Copy the full SHA aa957a7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4d9c06d - Browse repository at this point
Copy the full SHA 4d9c06dView commit details -
Configuration menu - View commit details
-
Copy full SHA for b46e6a3 - Browse repository at this point
Copy the full SHA b46e6a3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2466174 - Browse repository at this point
Copy the full SHA 2466174View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6987a21 - Browse repository at this point
Copy the full SHA 6987a21View commit details -
Configuration menu - View commit details
-
Copy full SHA for 80413f5 - Browse repository at this point
Copy the full SHA 80413f5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1902fd2 - Browse repository at this point
Copy the full SHA 1902fd2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2bc4024 - Browse repository at this point
Copy the full SHA 2bc4024View commit details -
Configuration menu - View commit details
-
Copy full SHA for 33601b4 - Browse repository at this point
Copy the full SHA 33601b4View commit details -
Configuration menu - View commit details
-
Copy full SHA for bec856c - Browse repository at this point
Copy the full SHA bec856cView commit details
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.