Merge branch 'master' into python-2.4

This commit is contained in:
rocky
2019-01-26 18:33:39 -05:00
30 changed files with 256 additions and 56 deletions

View File

@@ -66,6 +66,17 @@ class Python37Parser(Python36Parser):
# FIXME: generalize and specialize
call ::= expr CALL_METHOD_0
testtrue ::= compare_chained37
compare_chained37 ::= expr compare_chained1a_37
compare_chained37 ::= expr compare_chained1b_37
compare_chained2a_37 ::= expr COMPARE_OP POP_JUMP_IF_TRUE JUMP_FORWARD
compare_chained2b_37 ::= expr COMPARE_OP POP_JUMP_IF_FALSE JUMP_FORWARD
compare_chained1a_37 ::= expr DUP_TOP ROT_THREE COMPARE_OP POP_JUMP_IF_FALSE
compare_chained2a_37 ELSE POP_TOP COME_FROM
compare_chained1b_37 ::= expr DUP_TOP ROT_THREE COMPARE_OP POP_JUMP_IF_FALSE
compare_chained2b_37 ELSE POP_TOP JUMP_FORWARD COME_FROM
"""
def customize_grammar_rules(self, tokens, customize):
@@ -103,7 +114,7 @@ if __name__ == '__main__':
""".split()))
remain_tokens = set(tokens) - opcode_set
import re
remain_tokens = set([re.sub('_\d+$', '', t) for t in remain_tokens])
remain_tokens = set([re.sub(r'_\d+$', '', t) for t in remain_tokens])
remain_tokens = set([re.sub('_CONT$', '', t) for t in remain_tokens])
remain_tokens = set(remain_tokens) - opcode_set
print(remain_tokens)