builtup4/bu4/indexing/constructs/idelayed.py

27 lines
689 B
Python

# Copyright (c) PARRRATE T&V 2021. All rights reserved.
from bu4.evaluation.av.evtype import evtype
from bu4.evaluation.constructs.eidelayed import EIDelayed
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 EIDelayed(
ev,
self.value
)
def __str__(self):
return f'(){self.value}'
def __bytes__(self):
return bytes([CODE_DLYD, *bytes(self.value)])