diff options
| author | serpilliere <fabrice.desclaux@cea.fr> | 2015-10-27 21:56:07 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-10-29 15:51:16 +0100 |
| commit | 6cc0b1f94e32fc40a0224fd188faae699559bda3 (patch) | |
| tree | 024065ca00aa7d0b780fac14ca08b1839b0d5bdd /miasm2/core/parse_asm.py | |
| parent | 1c3ee672cf1b13d1fd8fefe99406ba1a3ba55861 (diff) | |
| download | focaccia-miasm-6cc0b1f94e32fc40a0224fd188faae699559bda3.tar.gz focaccia-miasm-6cc0b1f94e32fc40a0224fd188faae699559bda3.zip | |
Core/parse_asm: autopep8
Diffstat (limited to 'miasm2/core/parse_asm.py')
| -rw-r--r-- | miasm2/core/parse_asm.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/miasm2/core/parse_asm.py b/miasm2/core/parse_asm.py index 698cb35c..b8025990 100644 --- a/miasm2/core/parse_asm.py +++ b/miasm2/core/parse_asm.py @@ -19,7 +19,9 @@ size2pck = {8: 'B', 64: 'Q', } + class DirectiveAlign(object): + """Stand for alignment representation""" def __init__(self, alignment=1): @@ -28,6 +30,7 @@ class DirectiveAlign(object): def __str__(self): return "Alignment %s" % self.alignment + def guess_next_new_label(symbol_pool, gen_label_index=0): i = 0 gen_name = "loc_%.8X" @@ -38,6 +41,7 @@ def guess_next_new_label(symbol_pool, gen_label_index=0): return symbol_pool.add_label(name) i += 1 + def replace_expr_labels(expr, symbol_pool, replace_id): """Create asm_label of the expression @expr in the @symbol_pool Update @replace_id""" @@ -51,18 +55,18 @@ def replace_expr_labels(expr, symbol_pool, replace_id): replace_id[expr] = m2_expr.ExprId(new_lbl, expr.size) return replace_id[expr] + def replace_orphan_labels(instr, symbol_pool): """Link orphan labels used by @instr to the @symbol_pool""" for i, arg in enumerate(instr.args): replace_id = {} - arg.visit(lambda e:replace_expr_labels(e, - symbol_pool, - replace_id)) + arg.visit(lambda e: replace_expr_labels(e, + symbol_pool, + replace_id)) instr.args[i] = instr.args[i].replace_expr(replace_id) - def parse_txt(mnemo, attrib, txt, symbol_pool=None, gen_label_index=0): if symbol_pool is None: symbol_pool = asmbloc.asm_symbol_pool() |