def __ne__(self, other): try: return self.__eq__(other).boolean_not() except VirtualMachineInvalidOperationError: raise VirtualMachineInvalidOperationError( "Invalid operands for '~=' operation: {} and {}".format( self, other))
def _get_value_representation(value: Value): if isinstance(value, NumberValue): return str(value.value) elif isinstance(value, StringValue): return str(value.value) elif isinstance(value, NilValue): return 'nil' elif isinstance(value, BooleanValue): return 'true' if value.value else 'false' elif isinstance(value, BuiltinFunctionValue): return 'builtin_function_instance(name=\"{}\")'.format(value.name) elif isinstance(value, CustomFunctionValue): return 'function_instance(name=\"{}\", addr={})'.format( value.name, value.instruction_address) else: raise VirtualMachineInvalidOperationError( "Impossible to get value representation for value {}".format( value))
def boolean_not(self): raise VirtualMachineInvalidOperationError( "Invalid operand for 'not' operation: {}".format(self))
def __mul__(self, other): raise VirtualMachineInvalidOperationError( "Invalid operands for '*' operation: {} and {}".format( self, other))
def boolean_or(self, other): raise VirtualMachineInvalidOperationError( "Invalid operands for 'or' operation: {} and {}".format( self, other))
def concat(self, other): raise VirtualMachineInvalidOperationError( "Invalid operands for '..' operation: {} and {}".format( self, other))
def call(self, *args): raise VirtualMachineInvalidOperationError( "Impossible to call value: {}".format(self))
def __neg__(self): raise VirtualMachineInvalidOperationError( "Invalid operand for unary '-' operation: {}".format(self))