Home

# Class goog.dom.pattern.Matcher

Given a set of patterns and a root node, this class tests the patterns in parallel. It is not (yet) a smart matcher - it doesn't do any advanced backtracking. Given the pattern `DIV, SPAN` the matcher will not match `DIV, DIV, SPAN` because it starts matching at the first `DIV`, fails to match `SPAN` at the second, and never backtracks to try again. It is also possible to have a set of complex patterns that when matched in parallel will miss some possible matches. Running multiple times will catch all matches eventually.

Instance Method Summary
| `addPattern(?goog.dom.pattern.AbstractPattern pattern, ?Function callback)` Adds a pattern to be matched. The callback can return an object whose keys are processing instructions.
| `match(?Node node)` Match the set of patterns against a match tree.
| `matchToken_(?goog.dom.TagIterator position) ⇒ boolean` Test the given node against all patterns.
| `reset_()` Resets all the patterns.