-
Notifications
You must be signed in to change notification settings - Fork 2
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
Interline wildcards #42
Merged
Merged
Commits on May 16, 2024
-
Split apart the two different uses of the wildcard operator.
Wildcards within, and between, lines behave very differently, so split them into two different constants. Right now this doesn't make any difference (the constants are the same!), but it makes it clearer in the code which is which at different points.
Configuration menu - View commit details
-
Copy full SHA for c6fa53e - Browse repository at this point
Copy the full SHA c6fa53eView commit details -
Configuration menu - View commit details
-
Copy full SHA for a7ad059 - Browse repository at this point
Copy the full SHA a7ad059View commit details -
Change the default interline wildcard syntax to "..?".
This is so, when we shortly add new syntax, we can warn users of the change.
Configuration menu - View commit details
-
Copy full SHA for edf5480 - Browse repository at this point
Copy the full SHA edf5480View commit details -
Use
README.md
as the crate doc string.This means only having to edit one file instead of keeping two nearly-identical things in sync. It also means that the doc strings in the README are tested.
Configuration menu - View commit details
-
Copy full SHA for 7944723 - Browse repository at this point
Copy the full SHA 7944723View commit details
Commits on May 17, 2024
-
Introduce the
..*
interline wildcard.This allows "group matching", which also implies backtracing. Consider this pattern: ```text A ..? B C ..? ``` This will match successfully against the literal: ```text A D B C E ``` but fail to match against the literal: ```text A D B B C E ``` because the `..?` matched against the first "B", anchored the search, then immediately failed to match against the second "B". In contrast the pattern: ```text A ..* B C ..? ``` will, through backtracing, successfully match the literal. ```text A ..? B C ..* D E ``` There are two reasons why you should default to using `..?` rather than `..*`. Most obviously `..?` does not backtrack and has linear performance. Less obviously `..?` prevents literals from matching when they contain multiple similar sequences. Informally, `..?` makes for more rigorous testing: `..?` can be thought of as "the next thing that matches must look like X" whereas `..*` says "skip things that are almost like X until you find something that is definitely X". Consider this pattern: ```text A ..? B C ..? ``` This will match successfully against the literal: ```text A D B C E ``` but fail to match against the literal: ```text A D B B C E ``` because the `..?` matched against the first "B", anchored the search, then immediately failed to match against the second "B". In contrast the pattern: ```text A ..* B C ..? ``` will, through backtracing, successfully match the literal. ```text A ..? B C ..* D E ``` There are two reasons why you should default to using `..?` rather than `..*`. Most obviously `..?` does not backtrack and has linear performance. Less obviously `..?` prevents literals from matching when they contain multiple similar sequences. Informally, `..?` makes for more rigorous testing: `..?` can be thought of as "the next thing that matches must look like X" whereas `..*` says "skip things that are almost like X until you find something that is definitely X".
Configuration menu - View commit details
-
Copy full SHA for 4e83550 - Browse repository at this point
Copy the full SHA 4e83550View commit details -
Configuration menu - View commit details
-
Copy full SHA for b71e3df - Browse repository at this point
Copy the full SHA b71e3dfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0dc88e3 - Browse repository at this point
Copy the full SHA 0dc88e3View 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.