builtup4/bu4/indexing/constructs/idelayed.py
2021-09-09 08:16:01 +03:00

27 lines
685 B
Python

# Copyright (c) PARRRATE T&V 2021. All rights reserved.
from bu4.evaluation.av.evtype import evtype
from bu4.evaluation.constructs.edelayed import EDelayed
from bu4.evaluation.constructs.evaluable import Evaluable
from bu4.indexing.constructs.indexed import Indexed
from bu4.parsing.codes import CODE_DLYD
__all__ = ('IDelayed',)
class IDelayed(Indexed):
def __init__(self, value: Indexed):
self.value = value
def attach(self, ev: evtype) -> Evaluable:
return EDelayed(
ev,
self.value
)
def __str__(self):
return f'&{self.value}'
def __bytes__(self):
return bytes([CODE_DLYD, *bytes(self.value)])