Add support for assignment

This commit is contained in:
Bartłomiej Pluta
2019-07-05 23:33:28 +02:00
parent c1fbc2fe23
commit 2ecc86a9b2
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
from smnp.newast.node.expression import ExpressionNode
from smnp.newast.node.none import NoneNode
class AssignmentNode(ExpressionNode):
def __init__(self, pos):
super().__init__(pos)
self.children.append(NoneNode())
@property
def target(self):
return self[0]
@target.setter
def target(self, value):
self[0] = value
@property
def value(self):
return self[1]
@value.setter
def value(self, value):
self[1] = value
@classmethod
def _parse(cls, input):
raise RuntimeError("This class is not supposed to be automatically called")