MCPcopy Index your code
hub / github.com/docopt/docopt / match

Method match

docopt.py:255–272  ·  view source on GitHub ↗
(self, left, collected=None)

Source from the content-addressed store, hash-verified

253class OneOrMore(ParentPattern):
254
255 def match(self, left, collected=None):
256 assert len(self.children) == 1
257 collected = [] if collected is None else collected
258 l = left
259 c = collected
260 l_ = None
261 matched = True
262 times = 0
263 while matched:
264 # could it be that something didn't match but changed l or c?
265 matched, l, c = self.children[0].match(l, c)
266 times += 1 if matched else 0
267 if l_ == l:
268 break
269 l_ = l
270 if times >= 1:
271 return True, l, c
272 return False, left, collected
273
274
275class Either(ParentPattern):

Callers

nothing calls this directly

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected