コード例 #1
0
ファイル: Parser.py プロジェクト: wwzcrack/RLOBF
 def reduce_stack(self, stack, pre):
     """
     Compose instruction tuple
     :param stack: list of parsed instruction components
     :param pre: True if instruction has prefix operator
     """
     sl = len(stack)
     stack = stack[:1] + \
             (stack[::-1][1:-1] if isinstance(self, parseX86) else stack[1:-1]) + \
             stack[-1:] + [pre]
     if sl == 2: return Types.SingleInstr(stack)
     elif sl == 3: return Types.DoubleInstr(stack)
     elif sl == 4: return Types.TripleInstr(stack)
     elif sl == 5: return Types.FourInstr(stack)
     elif sl == 6: return Types.FiveInstr(stack)
     elif config.arch == config.ARCH_ARMT and sl == 8: return Types.CoproInstr(stack)
     raise Exception('Parsing error, strange number of tokens: ' + str(sl))