Beispiel #1
0
 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 = ""
Beispiel #2
0
 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)
Beispiel #3
0
 def target(self):
     return TFieldRef(
         name=self._target,
         parent=self,
         loc=Location(line=self.loc.line,
                      column=self.loc.column,
                      scope=self.loc.scope),
     )
Beispiel #4
0
 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
Beispiel #5
0
 def __init__(
     self,
     *,
     name: str,
     offset: Tuple[int, int, Union[int, Expr]] = (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)
Beispiel #6
0
 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
Beispiel #7
0
 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
Beispiel #8
0
 def build(self) -> Assign:
     if self.parent:
         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,
         ),
     )
Beispiel #9
0
 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