def __init__(self, *, name: str, domain: Domain, fields: List[str]): super().__init__(Location(line=0, column=0, scope=name)) self.name = name self.domain = domain self.fields = fields self.parameters = [] self.docstring = ""
def __init__( self, *, order: IterationOrder, start: int = 0, end: int = 0, scope: str = "<unnamed>" ): super().__init__(Location(line=0, column=0)) self.order = order self.start = start self.end = end self.scope = scope
def register_child(self, child: "TObject") -> None: child.loc = Location( line=self.loc.line + self.height, column=self.loc.column + self.width, scope=self.child_scope, ) child.parent = self self.children.append(child)
def target(self): return TFieldRef( name=self._target, parent=self, loc=Location(line=self.loc.line, column=self.loc.column, scope=self.loc.scope), )
def __init__( self, *, value: Any, loc: Location = None, parent: TObject = None, ): super().__init__(loc or Location(line=0, column=0), parent=parent) self.value = value
def __init__( self, *, name: str, offset: Tuple[int, int, int] = (0, 0, 0), loc: Location = None, parent: TObject = None, ): super().__init__(loc or Location(line=0, column=0), parent=parent) self.name = name self.offset = make_offset(offset)
def value(self): value = self._value if isinstance(self._value, str): value = TFieldRef(name=self._value, offset=self.offset) value.loc = Location( line=self.loc.line, column=self.loc.column + self.target.width + 3, scope=self.loc.scope, ) value.parent = self return value
def build(self) -> Assign: self.loc.scope = self.parent.child_scope return Assign( target=self.target.build(), value=self.value.build(), loc=Location( line=self.loc.line, column=self.loc.column + self.target.width + 1, scope=self.loc.scope, ), )
def __init__(self, target: str, value: Union[str, Expr, TObject], offset: Tuple[int, int, int]): super().__init__(Location(line=0, column=0)) self._target = target self._value = value self.offset = offset