def grammar(self, ast, *args): directives = OrderedDict((d.name, d.value) for d in ast.directives) keywords = set(ast.keywords or []) return grammars.Grammar(self.grammar_name, list(self.rules.values()), directives=directives, keywords=keywords)
def grammar(self, ast): return model.Grammar(self.name, ast.rules)
def grammar(self, ast): return model.Grammar(self.name, [r for r in ast.rules if r is not None])