Merge branch 'master' into python-2.4

This commit is contained in:
rocky
2017-03-01 05:55:26 -05:00
12 changed files with 75 additions and 24 deletions

View File

@@ -30,12 +30,18 @@ class PythonParser(GenericASTBuilder):
super(PythonParser, self).__init__(AST, start, debug)
self.collect = [
'stmts', 'except_stmts', '_stmts',
'exprlist', 'kvlist', 'kwargs', 'come_froms',
'exprlist', 'kvlist', 'kwargs', 'come_froms', '_come_from',
# Python < 3
'print_items',
# PyPy:
'kvlist_n']
def ast_first_offset(self, ast):
if hasattr(ast, 'offset'):
return ast.offset
else:
return self.ast_first_offset(ast[0])
def add_unique_rule(self, rule, opname, count, customize):
"""Add rule to grammar, but only if it hasn't been added previously
opname and count are used in the customize() semantic the actions