def argv(self): # TODO: sys.argv return ast.Primitive( IndexableNamespace(value=[ ast.Primitive(IndexableNamespace(value='"a"', lineno=-1), objects.String) ], lineno=-1), objects.List).eval(self)
def __init__(self, name, params, return_type, body, lineno): from violet.vast import Return, Primitive self.lineno = lineno self.name = name self.params = params self.return_type = return_type self.body = body self._return = None self._return_flag = False if body: # print(body[-1]) if not isinstance(body[-1], Return): body.append(Return(Primitive(IndexableNamespace(value='nil', lineno=body[-1].lineno), Void)))
def __init__(self, name, lineno): super().__init__(IndexableNamespace(lineno=lineno)) self.name = name
def __init__(self, body): super().__init__(IndexableNamespace(lineno=-1)) self.body = body
def __init__(self, prod): super().__init__(IndexableNamespace(lineno=prod.if_stmt.lineno)) for name in self.__slots__: attr = getattr(prod, name, None) # print(name, attr) setattr(self, name, attr)