示例#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 = ""
示例#2
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
示例#3
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)
示例#4
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),
     )
示例#5
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
示例#6
0
 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)
示例#7
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
示例#8
0
 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,
         ),
     )
示例#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