diff --git a/include/libsemigroups/aho-corasick.hpp b/include/libsemigroups/aho-corasick.hpp index 4f39261f4..6c65c32d0 100644 --- a/include/libsemigroups/aho-corasick.hpp +++ b/include/libsemigroups/aho-corasick.hpp @@ -41,6 +41,7 @@ // any given node is contained within. This could be updated easily when adding // new rules, but more care would be needed when removing rules. // TODO(0) change names from set_X and get_X to set(val) and get() +// TODO(2) add something that gets a ranges element to find all terminal nodes. namespace libsemigroups { //! \brief For an implementation of the Aho-Corasick algorithm diff --git a/include/libsemigroups/aho-corasick.tpp b/include/libsemigroups/aho-corasick.tpp index aed5b3474..fbf842158 100644 --- a/include/libsemigroups/aho-corasick.tpp +++ b/include/libsemigroups/aho-corasick.tpp @@ -23,11 +23,11 @@ namespace libsemigroups { AhoCorasick::index_type AhoCorasick::add_word(Iterator first, Iterator last) { auto last_index = traverse_trie(first, last); if (last_index != UNDEFINED && _all_nodes[last_index].is_terminal()) { - LIBSEMIGROUPS_EXCEPTION( - "word already exists in trie. Cannot add ({}, {}) since it already " - "corresponds to a terminal node", - *first, - *last); + LIBSEMIGROUPS_EXCEPTION("the word {} given by the arguments [first, " + "last) already belongs to the trie", + word_type(first, last)); + // Look in presentations and do one thing for chars and one thing for + // letter type. } return add_word_no_checks(first, last); } @@ -56,16 +56,16 @@ namespace libsemigroups { AhoCorasick::index_type AhoCorasick::rm_word(Iterator first, Iterator last) { auto last_index = traverse_trie(first, last); if (last_index == UNDEFINED) { - LIBSEMIGROUPS_EXCEPTION("cannot remove ({}, {}), as it does not " + LIBSEMIGROUPS_EXCEPTION("cannot remove the word {} given by the " + "arguments (first, last], as it does not " "correspond to a node in the trie", - *first, - *last); + word_type(first, last)); } if (!_all_nodes[last_index].is_terminal()) { - LIBSEMIGROUPS_EXCEPTION("cannot remove ({}, {}), as it does not " + LIBSEMIGROUPS_EXCEPTION("cannot remove the word {} given by the " + "arguments (first, last], as it does not " "correspond to a terminal node in the trie", - *first, - *last); + word_type(first, last)); } return rm_word_no_checks(first, last); }