-
Notifications
You must be signed in to change notification settings - Fork 0
/
variable.py
33 lines (27 loc) · 930 Bytes
/
variable.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from enum import Enum, auto
from parse.node import NodeType, NodeFunctionExpression
from interpreter.typing.basic_type import BasicType
from interpreter.function import Function
from interpreter.basic_value import BasicValue
class VariableType(Enum):
Auto = 'auto'
Int = 'int'
String = 'str'
Any = 'any'
Function = 'func'
Type = 'type'
Array = auto()
Dict = auto()
Object = auto() # Class, data structure, etc.
# class Variable(BasicValue):
# def __init__(self, name, vtype, value):
# BasicValue.__init__(self, value)
# self.name = name
# self.value = 0
# if (type(value) is NodeFunctionExpression):
# self.value = Function(name, vtype, value)
# else:
# self.value = value
# self.type = vtype
# def clone(self):
# return Variable(self.name, self.vtype, self.value)