54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
# Copyright (c) PARRRATE T&V 2021. All rights reserved.
|
|
|
|
from bu4.combinatory.lcombinatory import LCombinatory
|
|
from bu4.evaluation.constructs.evaluable import Evaluable
|
|
from bu4.evaluation.constructs.evalue import EValue
|
|
from bu4.indexing.constructs.indexed import Indexed
|
|
from bu4.indexing.evaluation.eivtype import eivtype
|
|
from bu4.linkable.evaluation.elvtype import elvtype
|
|
from bu4.parsing.codes import CODE_CMBI
|
|
from bu4.parsing.extensions.CodeExtension import CodeExtension
|
|
from bu4.transform.states.transformfinished import TransformFinished
|
|
from bu4.transform.states.transformstate import TransformState
|
|
|
|
__all__ = ('EIC', 'IIC', 'XII', 'LIC',)
|
|
|
|
|
|
class EIC(EValue):
|
|
def call(self, argument: Evaluable) -> Evaluable:
|
|
return argument
|
|
|
|
def __str__(self):
|
|
return f'I'
|
|
|
|
|
|
class IIC(Indexed):
|
|
def attach(self, ev: eivtype) -> Evaluable:
|
|
return EIC()
|
|
|
|
def bytes(self) -> TransformState[bytes]:
|
|
return TransformFinished(bytes([CODE_CMBI]))
|
|
|
|
def __str__(self):
|
|
return f'I'
|
|
|
|
|
|
class XII(CodeExtension[Indexed], code=CODE_CMBI):
|
|
def apply(self) -> TransformState[Indexed]:
|
|
return TransformFinished(IIC())
|
|
|
|
|
|
class LIC(LCombinatory):
|
|
def __init__(self):
|
|
self.future = set()
|
|
self.multifuture = set()
|
|
|
|
def attach(self, env: elvtype) -> Evaluable:
|
|
return EIC()
|
|
|
|
def index(self, promise: list[bytes]) -> TransformState[Indexed]:
|
|
return TransformFinished(IIC())
|
|
|
|
def __str__(self):
|
|
return f'I'
|