64 self._re_cache[pattern] = re.compile(pattern, self.flags) |
64 self._re_cache[pattern] = re.compile(pattern, self.flags) |
65 return self._re_cache[pattern].match(self.data, self.pos) |
65 return self._re_cache[pattern].match(self.data, self.pos) |
66 |
66 |
67 def test(self, pattern): |
67 def test(self, pattern): |
68 """Apply a pattern on the current position and check |
68 """Apply a pattern on the current position and check |
69 if it patches. Doesn't touch pos.""" |
69 if it patches. Doesn't touch pos. |
|
70 """ |
70 return self.check(pattern) is not None |
71 return self.check(pattern) is not None |
71 |
72 |
72 def scan(self, pattern): |
73 def scan(self, pattern): |
73 """ |
74 """ |
74 Scan the text for the given pattern and update pos/match |
75 Scan the text for the given pattern and update pos/match |