def __parse__(self, symbol_node: jcmuta.SymbolNode, code: int): """ :param symbol_node: :param code: :return: it recursively parses the symbolic node to z3.sexpr """ symbol_class = symbol_node.get_class_name() if symbol_class == "Identifier": return self.__parse_identifier__(symbol_node, code) elif symbol_class == "Constant": return self.__parse_constant__(symbol_node, code) elif symbol_class == "Literal": return self.__parse_literal__(symbol_node) elif symbol_class == "UnaryExpression": return self.__parse_unary_expression__(symbol_node, code) elif symbol_class == "ArithExpression": return self.__parse_arith_expression__(symbol_node, code) elif symbol_class == "BitwsExpression": return self.__parse_bitws_expression__(symbol_node) elif symbol_class == "LogicExpression": return self.__parse_logic_expression__(symbol_node, code) elif symbol_class == "RelationExpression": return self.__parse_relation_expression__(symbol_node, code) elif symbol_class == "AssignExpression": return self.__parse_assign_expression__(symbol_node, code) elif symbol_class == "CastExpression": return self.__parse_casted_expression__(symbol_node, code) elif symbol_class == "FieldExpression": return self.__parse_field_expression__(symbol_node, code) elif symbol_class == "IfElseExpression": return self.__parse_if_else_expression__(symbol_node, code) elif symbol_class == "CallExpression": return self.__parse_call_expression__(symbol_node, code) else: return self.__parse_list_expression__(symbol_node, code)
def __unique_name__(self, symbol_node: jcmuta.SymbolNode): """ :param symbol_node: the node of which unique name is created :return: the unique name of the symbol_node """ class_name = symbol_node.get_class_name() class_id = symbol_node.get_class_id() class_flag = 'p' if class_id < 0: class_id = abs(class_id) class_flag = 'n' return self.__naming__.format(class_name, class_flag, class_id)
def __new_default_name__(self, symbol_node: jcmuta.SymbolNode): self.__assume__(None) return "{}_{}".format(symbol_node.get_class_name(), abs(symbol_node.get_class_id()))