Add support for ignoreable patterns #45
Merged
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.
One irritation with fm is that if you need to match (potentially or definitely) different literal text in a pattern, you need to generate fresh pattern names for each match point, even though you're not comparing the contents of these names. For example, if you want to match against the text "a b" you might use a pattern
$1 $2
(note:$1 $1
would not match).This commit adds support for "ignorable" name matches, which match against literal text, but ignore what the contents are. For example, if you add
$_
as the ignorable pattern matching literal text then you can match againsta b
with$_ $_
.I'm not sure if
name_matcher_ignore
is the best name for the relevant configuration function, but at the very least it shows what this functionality can do, and that it's relatively easy to add in.