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.
This PR includes two changes:
AhoCorasickImplobjects can now act as a map. Presently, this only works when the value type of the map isRule *. The only reason for this was so I could quickly test everything was working as expected. I think it would be better if the value type was specified as a template parameter.OverlapIteratorTrieobject now exists as a way to iterate over the critical pairs stored in a trie. The returned type is anOverlapthat contains pointers to the rules in the trie, and the overlap length.Both
KnuthBendixandRewritingSystemTrienow use these objects.I have also included quite a few TODOs in this PR, many of which are phrased as questions which I expect can probably be answered quite quickly.
Things that should probably be done from here:
OverlapandAhoCorasickImpltemplate structs/classes that depend on the value type.AhoCorasickImplshould be moving forward. Should we be able to both insert and emplace? Do we still want to be able to query the data structure as if it were not a map? Should various members and functions be const or not?_rule_map.find(x)with_rule_trie.nodes_no_checks(x).value(). However, it is possible that we can improve some things now that we don't have two data structures. The two places that come to mind are confluence checking and theSearchIterators. Confluence checking should probably be replaced by a very small call to that uses theOverlapIteratorTrie.