예제 #1
0
 def __ne__(self, other):
     try:
         return self.__eq__(other).boolean_not()
     except VirtualMachineInvalidOperationError:
         raise VirtualMachineInvalidOperationError(
             "Invalid operands for '~=' operation: {} and {}".format(
                 self, other))
예제 #2
0
 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))
예제 #3
0
 def boolean_not(self):
     raise VirtualMachineInvalidOperationError(
         "Invalid operand for 'not' operation: {}".format(self))
예제 #4
0
 def __mul__(self, other):
     raise VirtualMachineInvalidOperationError(
         "Invalid operands for '*' operation: {} and {}".format(
             self, other))
예제 #5
0
 def boolean_or(self, other):
     raise VirtualMachineInvalidOperationError(
         "Invalid operands for 'or' operation: {} and {}".format(
             self, other))
예제 #6
0
 def concat(self, other):
     raise VirtualMachineInvalidOperationError(
         "Invalid operands for '..' operation: {} and {}".format(
             self, other))
예제 #7
0
 def call(self, *args):
     raise VirtualMachineInvalidOperationError(
         "Impossible to call value: {}".format(self))
예제 #8
0
 def __neg__(self):
     raise VirtualMachineInvalidOperationError(
         "Invalid operand for unary '-' operation: {}".format(self))