From 50486533b0cb9905eded9e3a1b062ad5506af793 Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 22 Jul 2024 08:58:57 -0400 Subject: [PATCH] Fix some spelling mistakes --- decompyle3/parsers/p37/full.py | 6 +++--- decompyle3/parsers/p37/lambda_custom.py | 2 +- decompyle3/parsers/p37/lambda_expr.py | 4 ++-- decompyle3/parsers/p38/full_custom.py | 4 ++-- decompyle3/parsers/p38pypy/full_custom.py | 4 ++-- decompyle3/parsers/parse_heads.py | 6 +++--- decompyle3/parsers/reduce_check/ifelsestmt.py | 2 +- decompyle3/parsers/reduce_check/iflaststmt.py | 4 ++-- decompyle3/parsers/reduce_check/ifstmt.py | 2 -- decompyle3/semantics/consts.py | 2 +- decompyle3/semantics/helper.py | 5 +++-- 11 files changed, 20 insertions(+), 21 deletions(-) diff --git a/decompyle3/parsers/p37/full.py b/decompyle3/parsers/p37/full.py index 93cae193..b6b91052 100644 --- a/decompyle3/parsers/p37/full.py +++ b/decompyle3/parsers/p37/full.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023 Rocky Bernstein +# Copyright (c) 2020-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 @@ -790,7 +790,7 @@ def p_grammar(self, args): def p_come_from3(self, args): """ # In 3.7+ a SETUP_LOOP to a JUMP_FORWARD can - # get replaced by the JUMP_FORWARD addressed. Therefore come froms may + # get replaced by the JUMP_FORWARD addressed. Therefore COME_FROMs may # appear out of nesting order. For example: # if x # for ... jump forward endif (1) @@ -935,7 +935,7 @@ def p_36misc(self, args): return_closure ::= LOAD_CLOSURE DUP_TOP STORE_NAME RETURN_VALUE RETURN_LAST # 3.6 due to jump optimization, we sometimes add RETURN_END_IF where - # RETURN_VALUE is meant. Specifcally this can happen in + # RETURN_VALUE is meant. Specifically this can happen in # ifelsestmt -> ...else_suite _. suite_stmts... (last) stmt return ::= return_expr RETURN_END_IF return ::= return_expr RETURN_VALUE diff --git a/decompyle3/parsers/p37/lambda_custom.py b/decompyle3/parsers/p37/lambda_custom.py index c59d724c..c6a7831c 100644 --- a/decompyle3/parsers/p37/lambda_custom.py +++ b/decompyle3/parsers/p37/lambda_custom.py @@ -314,7 +314,7 @@ def customize_grammar_rules_lambda37(self, tokens, customize): generator_exp_async ::= load_genexpr LOAD_STR MAKE_FUNCTION_0 get_aiter CALL_FUNCTION_1 - # FIXME this is a workaround for probalby some bug in the Earley parser + # FIXME this is a workaround for probably some bug in the Earley parser # if we use get_aiter, then list_comp_async doesn't match, and I don't # understand why. expr_get_aiter ::= expr GET_AITER diff --git a/decompyle3/parsers/p37/lambda_expr.py b/decompyle3/parsers/p37/lambda_expr.py index 7656147a..bcc3297f 100644 --- a/decompyle3/parsers/p37/lambda_expr.py +++ b/decompyle3/parsers/p37/lambda_expr.py @@ -210,7 +210,7 @@ def p_jump(self, args): def p_37chained(self, args): """ - # A compare_chained is two comparisions like x <= y <= z + # A compare_chained is two comparisons like x <= y <= z compare_chained ::= expr compare_chained_middle ROT_TWO POP_TOP _come_froms compare_chained ::= compare_chained37 compare_chained ::= compare_chained37_false @@ -545,7 +545,7 @@ def p_comprehension(self, args): comp_if ::= or_jump_if_false_loop_cf comp_iter # We need to have a reduction rule to disambiguate - # these "comp_if_not" and "comp_if". The difference is burried in the + # these "comp_if_not" and "comp_if". The difference is buried in the # sense of the jump in # comp_iter -> comp_if_or -> or_parts_false_loop # vs.: diff --git a/decompyle3/parsers/p38/full_custom.py b/decompyle3/parsers/p38/full_custom.py index 359a3057..7947495f 100644 --- a/decompyle3/parsers/p38/full_custom.py +++ b/decompyle3/parsers/p38/full_custom.py @@ -521,9 +521,9 @@ def customize_grammar_rules_full38(self, tokens, customize): COME_FROM_FINALLY END_ASYNC_FOR - # FIXME: come froms after the else_suite or + # FIXME: COME_FROMs after the else_suite or # END_ASYNC_FOR distinguish which of for / forelse - # is used. Add come froms and check of add up + # is used. Add COME_FROMs and check of add up # control-flow detection phase. # async_forelse_stmt38 ::= expr async_for store # for_block COME_FROM_FINALLY END_ASYNC_FOR diff --git a/decompyle3/parsers/p38pypy/full_custom.py b/decompyle3/parsers/p38pypy/full_custom.py index c1a4084b..517f1ea9 100644 --- a/decompyle3/parsers/p38pypy/full_custom.py +++ b/decompyle3/parsers/p38pypy/full_custom.py @@ -521,9 +521,9 @@ def customize_grammar_rules_full38(self, tokens, customize): COME_FROM_FINALLY END_ASYNC_FOR - # FIXME: come froms after the else_suite or + # FIXME: COME_FROMs after the else_suite or # END_ASYNC_FOR distinguish which of for / forelse - # is used. Add come froms and check of add up + # is used. Add COME_FROMs and check of add up # control-flow detection phase. # async_forelse_stmt38 ::= expr async_for store # for_block COME_FROM_FINALLY END_ASYNC_FOR diff --git a/decompyle3/parsers/parse_heads.py b/decompyle3/parsers/parse_heads.py index a2f399ab..cd04980d 100644 --- a/decompyle3/parsers/parse_heads.py +++ b/decompyle3/parsers/parse_heads.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Rocky Bernstein +# Copyright (c) 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 @@ -99,7 +99,7 @@ def __init__(self, debug_parser, start_symbol, is_lambda=False): self.insts = [] # True if we are parsing inside a lambda expression. - # because a lambda expression are wrtten on a single line, certain line-oriented + # because a lambda expression are written on a single line, certain line-oriented # statements behave differently self.is_lambda = is_lambda @@ -422,6 +422,6 @@ def __init__(self, compile_mode, debug_parser): self.insts = [] # true if we are parsing inside a lambda expression. - # because a lambda expression are wrtten on a single line, certain line-oriented + # because a lambda expression are written on a single line, certain line-oriented # statements behave differently self.is_lambda = False diff --git a/decompyle3/parsers/reduce_check/ifelsestmt.py b/decompyle3/parsers/reduce_check/ifelsestmt.py index 431d257b..237785d4 100644 --- a/decompyle3/parsers/reduce_check/ifelsestmt.py +++ b/decompyle3/parsers/reduce_check/ifelsestmt.py @@ -74,7 +74,7 @@ def ifelsestmt( if come_from_target < first_offset: return True - # Make sure all the offsets from the "come froms" at the + # Make sure all the offsets from the "COME_FROMs" at the # end of the "if" come from somewhere inside the "if". # Since the come_froms are ordered so that lowest # offset COME_FROM is last, it is sufficient to test diff --git a/decompyle3/parsers/reduce_check/iflaststmt.py b/decompyle3/parsers/reduce_check/iflaststmt.py index a3ad5032..73105569 100644 --- a/decompyle3/parsers/reduce_check/iflaststmt.py +++ b/decompyle3/parsers/reduce_check/iflaststmt.py @@ -43,7 +43,7 @@ def iflaststmt( ("testexprc", "c_stmts"), ): - # "stmts" (end of then) should not end in a fallthough instruction + # "stmts" (end of then) should not end in a fallthrough instruction # other wise this is just a plain ol' stmt. ltm1 = tokens[last - 1] if ltm1 == "COME_FROM": @@ -121,7 +121,7 @@ def iflaststmt( if last_inst.is_jump(): return target_offset == last_offset else: - # A fallthough can't jump *beyond* the end in the nested + # A fallthrough can't jump *beyond* the end in the nested # "if" around and outer "else" return True pass diff --git a/decompyle3/parsers/reduce_check/ifstmt.py b/decompyle3/parsers/reduce_check/ifstmt.py index 8d637df6..e228274c 100644 --- a/decompyle3/parsers/reduce_check/ifstmt.py +++ b/decompyle3/parsers/reduce_check/ifstmt.py @@ -123,8 +123,6 @@ def ifstmt( return True pass - print("XXX", self) - print("XXX1", dir(self)) endif_inst_index = self.offset2inst_index[ltm1.off2int(prefer_last=False)] # FIXME: RAISE_VARARGS is an instance of a no-follow instruction. diff --git a/decompyle3/semantics/consts.py b/decompyle3/semantics/consts.py index 37c5a058..5dce0c55 100644 --- a/decompyle3/semantics/consts.py +++ b/decompyle3/semantics/consts.py @@ -524,7 +524,7 @@ # function_def_async "mkfuncdeco0": ("%|def %c\n", (0, "mkfunc")), - # In cases where we desire an explict new line. + # In cases where we desire an explicit new line. # After docstrings which are followed by a "def" is # one situations where Python formatting desires two newlines, # and this is added, as a transformation rule. diff --git a/decompyle3/semantics/helper.py b/decompyle3/semantics/helper.py index e947ee91..8abd8c70 100644 --- a/decompyle3/semantics/helper.py +++ b/decompyle3/semantics/helper.py @@ -1,6 +1,7 @@ import sys from xdis import iscode + from decompyle3.parsers.treenode import SyntaxTree minint = -sys.maxsize - 1 @@ -29,8 +30,8 @@ def escape_string(s: str, quotes=('"', "'", '"""', "'''")): return "%s%s%s" % (quote, s, quote) -# FIXME: this and find_globals could be paramaterized with one of the -# above global ops +# FIXME: This and find_globals could be parameterized with one of the +# above global ops. def find_all_globals(node, globs): """Search Syntax Tree node to find variable names that are global.""" for n in node: