NT passtmt -> pass to match AST

This commit is contained in:
rocky
2017-12-14 05:31:17 -05:00
parent 3ce5e0ab0e
commit 4cd4ad22b6
5 changed files with 10 additions and 10 deletions

View File

@@ -220,7 +220,7 @@ class PythonParser(GenericASTBuilder):
def p_stmt(self, args): def p_stmt(self, args):
""" """
passstmt ::= pass ::=
_stmts ::= stmt+ _stmts ::= stmt+
@@ -235,7 +235,7 @@ class PythonParser(GenericASTBuilder):
lastc_stmt ::= ifelsestmtc lastc_stmt ::= ifelsestmtc
c_stmts_opt ::= c_stmts c_stmts_opt ::= c_stmts
c_stmts_opt ::= passstmt c_stmts_opt ::= pass
l_stmts ::= _stmts l_stmts ::= _stmts
l_stmts ::= return_stmts l_stmts ::= return_stmts
@@ -249,7 +249,7 @@ class PythonParser(GenericASTBuilder):
lastl_stmt ::= tryelsestmtl lastl_stmt ::= tryelsestmtl
l_stmts_opt ::= l_stmts l_stmts_opt ::= l_stmts
l_stmts_opt ::= passstmt l_stmts_opt ::= pass
suite_stmts ::= _stmts suite_stmts ::= _stmts
suite_stmts ::= return_stmts suite_stmts ::= return_stmts
@@ -258,7 +258,7 @@ class PythonParser(GenericASTBuilder):
suite_stmts_opt ::= suite_stmts suite_stmts_opt ::= suite_stmts
# passtmt is needed for semantic actions to add "pass" # passtmt is needed for semantic actions to add "pass"
suite_stmts_opt ::= passstmt suite_stmts_opt ::= pass
else_suite ::= suite_stmts else_suite ::= suite_stmts
else_suitel ::= l_stmts else_suitel ::= l_stmts

View File

@@ -152,7 +152,7 @@ class Python3Parser(PythonParser):
else_suite _come_froms else_suite _come_froms
# ifelsestmt ::= testexpr c_stmts_opt jump_forward_else # ifelsestmt ::= testexpr c_stmts_opt jump_forward_else
# passstmt _come_froms # pass _come_froms
ifelsestmtc ::= testexpr c_stmts_opt JUMP_ABSOLUTE else_suitec ifelsestmtc ::= testexpr c_stmts_opt JUMP_ABSOLUTE else_suitec
ifelsestmtc ::= testexpr c_stmts_opt jump_absolute_else else_suitec ifelsestmtc ::= testexpr c_stmts_opt jump_absolute_else else_suitec

View File

@@ -77,7 +77,7 @@ class Python35Parser(Python34Parser):
LOAD_GLOBAL COMPARE_OP POP_JUMP_IF_FALSE LOAD_GLOBAL COMPARE_OP POP_JUMP_IF_FALSE
POP_TOP POP_TOP POP_TOP POP_EXCEPT POP_BLOCK POP_TOP POP_TOP POP_TOP POP_EXCEPT POP_BLOCK
JUMP_ABSOLUTE END_FINALLY JUMP_BACK JUMP_ABSOLUTE END_FINALLY JUMP_BACK
passstmt POP_BLOCK JUMP_ABSOLUTE pass POP_BLOCK JUMP_ABSOLUTE
COME_FROM_LOOP COME_FROM_LOOP
stmt ::= async_forelse_stmt stmt ::= async_forelse_stmt

View File

@@ -32,7 +32,7 @@ RETURN_NONE = AST('stmt',
PASS = AST('stmts', PASS = AST('stmts',
[ AST('sstmt', [ AST('sstmt',
[ AST('stmt', [ AST('stmt',
[ AST('passstmt', [])])])]) [ AST('pass', [])])])])
ASSIGN_DOC_STRING = lambda doc_string: \ ASSIGN_DOC_STRING = lambda doc_string: \
AST('stmt', AST('stmt',
@@ -276,7 +276,7 @@ TABLE_DIRECT = {
'except_cond1': ( '%|except %c:\n', 1 ), 'except_cond1': ( '%|except %c:\n', 1 ),
'except_suite': ( '%+%c%-%C', 0, (1, maxint, '') ), 'except_suite': ( '%+%c%-%C', 0, (1, maxint, '') ),
'except_suite_finalize': ( '%+%c%-%C', 1, (3, maxint, '') ), 'except_suite_finalize': ( '%+%c%-%C', 1, (3, maxint, '') ),
'passstmt': ( '%|pass\n', ), 'pass': ( '%|pass\n', ),
'STORE_FAST': ( '%{pattr}', ), 'STORE_FAST': ( '%{pattr}', ),
'kv': ( '%c: %c', 3, 1 ), 'kv': ( '%c: %c', 3, 1 ),
'kv2': ( '%c: %c', 1, 2 ), 'kv2': ( '%c: %c', 1, 2 ),

View File

@@ -86,7 +86,7 @@ ExtractInfo = namedtuple("ExtractInfo",
TABLE_DIRECT_FRAGMENT = { TABLE_DIRECT_FRAGMENT = {
'break': ( '%|%rbreak\n', ), 'break': ( '%|%rbreak\n', ),
'continue ': ( '%|%rcontinue\n', ), 'continue ': ( '%|%rcontinue\n', ),
'passstmt': ( '%|%rpass\n', ), 'pass': ( '%|%rpass\n', ),
'raise_stmt0': ( '%|%rraise\n', ), 'raise_stmt0': ( '%|%rraise\n', ),
'import': ( '%|import %c%x\n', 2, (2, (0, 1)), ), 'import': ( '%|import %c%x\n', 2, (2, (0, 1)), ),
'importfrom': ( '%|from %[2]{pattr}%x import %c\n', (2, (0, 1)), 3), 'importfrom': ( '%|from %[2]{pattr}%x import %c\n', (2, (0, 1)), 3),
@@ -850,7 +850,7 @@ class FragmentsWalker(pysource.SourceWalker, object):
def n__ifstmts_jump_exit(self, node): def n__ifstmts_jump_exit(self, node):
if len(node) > 1: if len(node) > 1:
if (node[0] == 'c_stmts_opt' and if (node[0] == 'c_stmts_opt' and
node[0][0] == 'passstmt' and node[0][0] == 'pass' and
node[1].kind.startswith('JUMP_FORWARD')): node[1].kind.startswith('JUMP_FORWARD')):
self.set_pos_info(node[1], node[0][0].start, node[0][0].finish) self.set_pos_info(node[1], node[0][0].start, node[0][0].finish)