def parseGame(self, tree): """ Accepts either a string, or a tree. """ if not isinstance(tree, Node): tree = indentTreeParser(tree).children[0] sclass, args = self._parseArgs(tree.content) self.game = sclass(**args) for c in tree.children: if c.content == "SpriteSet": self.parseSprites(c.children) #Return list of sprite types. return self.sprite_types.values()
def parseGame(self, tree): """ Accepts either a string, or a tree. """ if not isinstance(tree, Node): tree = indentTreeParser(tree).children[0] sclass, args = self._parseArgs(tree.content) self.game = sclass(**args) for c in tree.children: if c.content == "SpriteSet": self.parseSprites(c.children) if c.content == "InteractionSet": self.parseInteractions(c.children) if c.content == "LevelMapping": self.parseMappings(c.children) if c.content == "TerminationSet": self.parseTerminations(c.children) return self.game