From 0e7160cd6b3c5c0a94d1bef53c07d2c7d30cb4f7 Mon Sep 17 00:00:00 2001 From: serpilliere Date: Tue, 27 Oct 2015 23:16:49 +0100 Subject: Expression: enhance exprop repr --- miasm2/expression/expression.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'miasm2/expression/expression.py') diff --git a/miasm2/expression/expression.py b/miasm2/expression/expression.py index 5ceb17d6..f49b31df 100644 --- a/miasm2/expression/expression.py +++ b/miasm2/expression/expression.py @@ -793,11 +793,13 @@ class ExprOp(Expr): def __str__(self): if self.is_associative(): return '(' + self._op.join([str(arg) for arg in self._args]) + ')' + if (self._op.startswith('call_func_') or + len(self._args) > 2 or + self._op in ['parity', 'segm']): + return self._op + '(' + ', '.join([str(arg) for arg in self._args]) + ')' if len(self._args) == 2: return ('(' + str(self._args[0]) + ' ' + self.op + ' ' + str(self._args[1]) + ')') - elif len(self._args) > 2: - return self._op + '(' + ', '.join([str(arg) for arg in self._args]) + ')' else: return reduce(lambda x, y: x + ' ' + str(y), self._args, -- cgit 1.4.1