Go back to previous matcher signature, with on_match positional

This commit is contained in:
Matthew Honnibal 2017-05-23 04:37:40 -05:00
parent 5418bcf5d7
commit e27262f431

View File

@ -215,7 +215,7 @@ cdef class Matcher:
""" """
return len(self._patterns) return len(self._patterns)
def add(self, key, *patterns, **kwargs): def add(self, key, on_match, *patterns):
"""Add a match-rule to the matcher. """Add a match-rule to the matcher.
A match-rule consists of: an ID key, an on_match callback, and one or A match-rule consists of: an ID key, an on_match callback, and one or
more patterns. If the key exists, the patterns are appended to the more patterns. If the key exists, the patterns are appended to the
@ -227,7 +227,6 @@ cdef class Matcher:
descriptors can also include quantifiers. There are currently important descriptors can also include quantifiers. There are currently important
known problems with the quantifiers see the docs. known problems with the quantifiers see the docs.
""" """
on_match = kwargs.get('on_match', None)
for pattern in patterns: for pattern in patterns:
if len(pattern) == 0: if len(pattern) == 0:
msg = ("Cannot add pattern for zero tokens to matcher.\n" msg = ("Cannot add pattern for zero tokens to matcher.\n"