fix python 2->3 issue with calling instance methods

--HG--
branch : pmacs2
This commit is contained in:
~d6 2020-08-31 22:13:37 -04:00
parent e103ebfa58
commit 13a4637c42
1 changed files with 16 additions and 6 deletions

View File

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