| 35 | while (out->next) out = out->next; |
| 36 | out->next = s->fail->out; } } } } } |
| 37 | vector<string> search(string s) { |
| 38 | vector<string> res; |
| 39 | go_node *cur = go; |
| 40 | iter(c, s) { |
| 41 | while (cur && cur->next.find(*c) == cur->next.end()) |
| 42 | cur = cur->fail; |
| 43 | if (!cur) cur = go; |
| 44 | cur = cur->next[*c]; |
| 45 | if (!cur) cur = go; |
| 46 | for (out_node *out = cur->out; out; out = out->next) |
| 47 | res.push_back(out->keyword); } |
| 48 | return res; } }; |
| 49 | // vim: cc=60 ts=2 sts=2 sw=2: |
nothing calls this directly
no outgoing calls
no test coverage detected