mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-11-23 05:00:07 +00:00
Update copyright
This commit is contained in:
parent
f030b3316c
commit
9d150e0707
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2016-2020, 2023 Rocky Bernstein
|
||||
# Copyright (c) 2016-2020, 2023-2024 Rocky Bernstein
|
||||
# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
|
||||
# Copyright (c) 2000-2002 by hartmut Goebel <hartmut@goebel.noris.de>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2016-2017, 2022 Rocky Bernstein
|
||||
# Copyright (c) 2016-2017, 2022, 2024 Rocky Bernstein
|
||||
"""
|
||||
spark grammar differences over Python 3.2 for Python 3.1.
|
||||
"""
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2016-2017, 2022 Rocky Bernstein
|
||||
# Copyright (c) 2016-2017, 2022-2024 Rocky Bernstein
|
||||
"""
|
||||
spark grammar differences over Python 3 for Python 3.2.
|
||||
"""
|
||||
@ -84,7 +84,7 @@ class Python32Parser(Python3Parser):
|
||||
for i, token in enumerate(tokens):
|
||||
opname = token.kind
|
||||
if opname.startswith("MAKE_FUNCTION_A"):
|
||||
args_pos, args_kw, annotate_args = token.attr
|
||||
args_pos, _, annotate_args = token.attr
|
||||
# Check that there are 2 annotated params?
|
||||
rule = (
|
||||
"mkfunc_annotate ::= %s%sannotate_tuple "
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2017-2018 Rocky Bernstein
|
||||
# Copyright (c) 2017-2018, 2022-2024 Rocky Bernstein
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -21,7 +21,6 @@ from uncompyle6.parsers.parse33 import Python33Parser
|
||||
|
||||
|
||||
class Python34Parser(Python33Parser):
|
||||
|
||||
def p_misc34(self, args):
|
||||
"""
|
||||
expr ::= LOAD_ASSERT
|
||||
@ -57,36 +56,45 @@ class Python34Parser(Python33Parser):
|
||||
"""
|
||||
|
||||
def customize_grammar_rules(self, tokens, customize):
|
||||
self.remove_rules("""
|
||||
self.remove_rules(
|
||||
"""
|
||||
yield_from ::= expr expr YIELD_FROM
|
||||
# 3.4.2 has this. 3.4.4 may now
|
||||
# while1stmt ::= SETUP_LOOP l_stmts COME_FROM JUMP_BACK COME_FROM_LOOP
|
||||
""")
|
||||
"""
|
||||
)
|
||||
super(Python34Parser, self).customize_grammar_rules(tokens, customize)
|
||||
return
|
||||
|
||||
|
||||
class Python34ParserSingle(Python34Parser, PythonParserSingle):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
# Check grammar
|
||||
p = Python34Parser()
|
||||
p.check_grammar()
|
||||
from xdis.version_info import IS_PYPY, PYTHON_VERSION_TRIPLE
|
||||
|
||||
if PYTHON_VERSION_TRIPLE[:2] == (3, 4):
|
||||
lhs, rhs, tokens, right_recursive, dup_rhs = p.check_sets()
|
||||
from uncompyle6.scanner import get_scanner
|
||||
|
||||
s = get_scanner(PYTHON_VERSION_TRIPLE, IS_PYPY)
|
||||
opcode_set = set(s.opc.opname).union(set(
|
||||
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
|
||||
opcode_set = set(s.opc.opname).union(
|
||||
set(
|
||||
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
|
||||
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP LOAD_CLASSNAME
|
||||
LAMBDA_MARKER RETURN_LAST
|
||||
""".split()))
|
||||
""".split()
|
||||
)
|
||||
)
|
||||
remain_tokens = set(tokens) - opcode_set
|
||||
import re
|
||||
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([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)
|
||||
# print(sorted(p.rule2name.items()))
|
||||
|
Loading…
Reference in New Issue
Block a user