Skip to content

Commit

Permalink
Sync with uncompyle6
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Jun 3, 2024
1 parent e074119 commit 4b36f94
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions decompyle3/semantics/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@
"ifelsestmt": ("%|if %c:\n%+%c%-%|else:\n%+%c%-", 0, 1, 3),
"ifelsestmtc": ("%|if %c:\n%+%c%-%|else:\n%+%c%-", 0, 1, 3),

# This are created only via transformation
# This is created only via transformation.
"ifelifstmt": ("%|if %c:\n%+%c%-%c", 0, 1, 3),

"ifelsestmtr": ("%|if %c:\n%+%c%-%|else:\n%+%c%-", 0, 1, 2),
Expand All @@ -496,7 +496,9 @@
(3, "importlist")
),

"import_from_star": ("%|from %[2]{pattr} import *\n",),
"import_from_star": (
"%|from %[2]{pattr} import *\n",
),

"kv": ("%c: %c", 3, 1),
"kv2": ("%c: %c", 1, 2),
Expand Down Expand Up @@ -528,7 +530,7 @@
# and this is added, as a transformation rule.
"newline": ("\n"),

"or": ("%c or %c", 0, 1),
"or": ("%p or %p", (0, PRECEDENCE["or"]), (1, PRECEDENCE["or"])),
"or_expr": ("%c or %c", (0, "expr"), (2, "expr"),),

"pass": ("%|pass\n",),
Expand All @@ -537,7 +539,8 @@
"raise_stmt1": ("%|raise %c\n", 0),
"raise_stmt3": ("%|raise %c, %c, %c\n", 0, 1, 2),

# "yield": ( "yield %c", 0),
# Note: we have a custom rule, which calls when we don't
# have "return None"
# "return": ( "%|return %c\n", 0),
"return_if_stmt": ("return %c\n", 0),

Expand Down Expand Up @@ -569,7 +572,10 @@
(2, NO_PARENTHESIS_EVER)
),

"store_subscript": ("%p[%c]", (0, "expr", PRECEDENCE["subscript"]), (1, "expr")),
"store_subscript": (
"%p[%c]",
(0, "expr", PRECEDENCE["subscript"]), (1, "expr")
),

# This nonterminal we create on the fly in semantic routines
"store_w_parens": (
Expand All @@ -580,7 +586,7 @@
# This is only generated by transform
# it is a string at the beginning of a function that is *not* a docstring
# 3.7 test_fstring.py tests for this kind of crap.
# For compatibility with older Python, we"ll use "%" instead of
# For compatibility with older Python, we'll use "%" instead of
# a format string.
"string_at_beginning": ('%|"%%s" %% %c\n', 0),

Expand All @@ -596,7 +602,6 @@
(1, "expr", NO_PARENTHESIS_EVER)
),


"testtrue": ("not %p", (0, PRECEDENCE["unary_not"])),

"try_except": ("%|try:\n%+%c%-%c\n\n", 1, 3),
Expand Down Expand Up @@ -644,6 +649,9 @@
(3, ("suite_stmts_opt", "_stmts")),
),

# "yield": ( "yield %c", 0),


}
# fmt: on

Expand Down

0 comments on commit 4b36f94

Please sign in to comment.