Skip to content

Commit 39f4dfb

Browse files
committed
Small tweaks
call_stmt -> expr_stmt when that's what it is version tuple things
1 parent a97fd62 commit 39f4dfb

File tree

3 files changed

+323
-391
lines changed

3 files changed

+323
-391
lines changed

decompyle3/parsers/p37/full.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ def p_start(self, args):
3232
stmts ::= sstmt+
3333
"""
3434

35-
def p_call_stmt(self, args):
35+
def p_eval_mode(self, args):
3636
"""
3737
# eval-mode compilation. Single-mode interactive compilation
3838
# adds another rule.
39-
call_stmt ::= expr POP_TOP
39+
expr_stmt ::= expr POP_TOP
4040
"""
4141

4242
def p_stmt_loop(self, args):
@@ -134,8 +134,11 @@ def p_stmt(self, args):
134134
else_suite ::= returns
135135
136136
stmt ::= classdef
137+
stmt ::= expr_stmt
137138
stmt ::= call_stmt
138139
140+
call_stmt ::= call
141+
139142
stmt ::= ifstmt
140143
stmt ::= if_or_stmt
141144
stmt ::= if_and_stmt

decompyle3/scanners/scanner37base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2015-2020 by Rocky Bernstein
1+
# Copyright (c) 2015-2021 by Rocky Bernstein
22
# Copyright (c) 2005 by Dan Pascu <[email protected]>
33
# Copyright (c) 2000-2002 by hartmut Goebel <[email protected]>
44
#
@@ -930,11 +930,10 @@ def next_except_jump(self, start):
930930
import inspect
931931

932932
co = inspect.currentframe().f_code # type: ignore
933-
from decompyle3 import PYTHON_VERSION
934933

935-
tokens, customize = Scanner37Base(PYTHON_VERSION).ingest(co)
934+
tokens, customize = Scanner37Base(PYTHON_VERSION_TRIPLE).ingest(co)
936935
for t in tokens:
937936
print(t)
938937
else:
939-
print(f"Need to be Python 3.7 to demo; I am version {version_tuple_to_str}.")
938+
print(f"Need to be Python 3.7 to demo; I am version {version_tuple_to_str()}.")
940939
pass

0 commit comments

Comments
 (0)