in pachi_py/pachi/tools/sgflib/sgflib.py [0:0]
def parseVariations(self):
""" Called when "(" encountered inside a 'GameTree', ends when a
non-matching ")" encountered. Returns a list of variation
'GameTree''s. Raises 'EndOfDataParseError' if the end of 'self.data'
is reached before the end of the enclosing 'GameTree'."""
v = []
while self.index < self.datalen:
# check for ")" at end of GameTree, but don't consume it
match = self.reGameTreeEnd.match(self.data, self.index)
if match:
return v
g = self.parseGameTree()
if g:
v.append(g)
# check for next variation, and consume "("
match = self.reGameTreeStart.match(self.data, self.index)
if match:
self.index = match.end()
raise EndOfDataParseError