diff --git a/parse.py b/parse.py index 973a12f..5afe248 100644 --- a/parse.py +++ b/parse.py @@ -65,9 +65,10 @@ class Stringre(Rule): return [] class Match(Rule): - method = lex.Token.match def __init__(self, *args): self.args = args + def method(self, tok, name, string): + return tok.match(name, string) def match(self, tokens): if not tokens: return [] @@ -75,17 +76,26 @@ class Match(Rule): return [1] else: return [] + class Matchs(Match): - method = lex.Token.matchs + def method(self, tok, name, strings): + return tok.matchs(name, strings) + class Matchp(Match): - method = lex.Token.matchp + def method(self, tok, pairs): + return tok.matchp(pairs) class Fqmatch(Match): - method = lex.Token.fqmatch + def method(self, tok, name, string): + return tok.fqmatch(name, string) + class Fqmatchs(Match): - method = lex.Token.fqmatchs + def method(self, name, strings, nocase=False): + return tok.fqmatchs(name, strings, nocase) + class Fqmatchp(Match): - method = lex.Token.fqmatchp + def method(self, name, pairs): + return tok.fqmatchp(pairs) class And(Rule): def match(self, tokens):