Skip to content

Commit

Permalink
Small tweaks
Browse files Browse the repository at this point in the history
call_stmt -> expr_stmt when that's what it is
version tuple things
  • Loading branch information
rocky committed Nov 16, 2021
1 parent a97fd62 commit 39f4dfb
Show file tree
Hide file tree
Showing 3 changed files with 323 additions and 391 deletions.
7 changes: 5 additions & 2 deletions decompyle3/parsers/p37/full.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def p_start(self, args):
stmts ::= sstmt+
"""

def p_call_stmt(self, args):
def p_eval_mode(self, args):
"""
# eval-mode compilation. Single-mode interactive compilation
# adds another rule.
call_stmt ::= expr POP_TOP
expr_stmt ::= expr POP_TOP
"""

def p_stmt_loop(self, args):
Expand Down Expand Up @@ -134,8 +134,11 @@ def p_stmt(self, args):
else_suite ::= returns
stmt ::= classdef
stmt ::= expr_stmt
stmt ::= call_stmt
call_stmt ::= call
stmt ::= ifstmt
stmt ::= if_or_stmt
stmt ::= if_and_stmt
Expand Down
7 changes: 3 additions & 4 deletions decompyle3/scanners/scanner37base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015-2020 by Rocky Bernstein
# Copyright (c) 2015-2021 by Rocky Bernstein
# Copyright (c) 2005 by Dan Pascu <[email protected]>
# Copyright (c) 2000-2002 by hartmut Goebel <[email protected]>
#
Expand Down Expand Up @@ -930,11 +930,10 @@ def next_except_jump(self, start):
import inspect

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

tokens, customize = Scanner37Base(PYTHON_VERSION).ingest(co)
tokens, customize = Scanner37Base(PYTHON_VERSION_TRIPLE).ingest(co)
for t in tokens:
print(t)
else:
print(f"Need to be Python 3.7 to demo; I am version {version_tuple_to_str}.")
print(f"Need to be Python 3.7 to demo; I am version {version_tuple_to_str()}.")
pass
Loading

0 comments on commit 39f4dfb

Please sign in to comment.