def generate(cls, tree, features): """ Parses an AST and checks it. """ tree = Lowering(parser=tree.parser, features=features).process(tree) module = Semantics(features=features).process(tree) return tree, module
def parse(source, lower=False): """ Don't regenerate the parser on every call """ tree = _parser().parse(source, allow_single_quotes=False) if not lower: return tree return Lowering(parser=tree.parser, features={}).process(tree)
def parse(source, lower=False): """ Don't regenerate the parser on every call """ tree = _parser().parse(source) if not lower: return tree return Lowering(parser=tree.parser).process(tree)
def generate(cls, tree, storycontext, scope): """ Parses an AST and checks it. """ tree = Lowering( parser=tree.parser, features=storycontext.features ).process(tree) module = Semantics( storycontext=storycontext, root_scope=scope ).process(tree) return tree, module
def test_story_parse_lower(patch, story, parser): patch.object(Lowering, 'process') story.parse(parser=parser, lower=True) parser.parse.assert_called_with(story.story) Lowering.process.assert_called_with(Parser.parse()) assert story.tree == Lowering.process(Lowering.process())
def generate(cls, tree, debug=False): """ Parses an AST and checks it. """ tree = Lowering(parser=tree.parser).process(tree) return Semantics().process(tree)