def inner_invoke(self, args): import pixie.vm.rt as rt import pixie.vm.persistent_vector as vector with with_ns(u"user"): NS_VAR.deref().include_stdlib() acc = vector.EMPTY for x in self._argv: acc = rt.conj(acc, rt.wrap(x)) PROGRAM_ARGUMENTS.set_root(acc) with with_ns(u"user"): try: f = None if self._file == '-': f, _, _ = create_stdio() else: if not path.isfile(self._file): print "Error: Cannot open '" + self._file + "'" os._exit(1) f = open(self._file) data = f.read() f.close() if data.startswith("#!"): newline_pos = data.find("\n") if newline_pos > 0: data = data[newline_pos:] rt.load_reader(StringReader(unicode_from_utf8(data))) except WrappedException as ex: print "Error: ", ex._ex.__repr__() os._exit(1)
def inner_invoke(self, args): import pixie.vm.rt as rt with with_ns(u"user"): NS_VAR.deref().include_stdlib() rt.load_reader(StringReader(unicode_from_utf8(self._expr)))
def test_forms(self): for s in data: tst = data[s] result = read(StringReader(s), True) assert isinstance(result, Object) self._compare(result, tst)
def inner_invoke(self, args): import pixie.vm.rt as rt with with_ns(u"user"): NS_VAR.deref().include_stdlib() interpret( compile(read(StringReader(unicode_from_utf8(self._expr)), True)))
def eval_string(s): with with_ns(u"user", True): rdr = StringReader(unicode(s)) result = nil while True: form = read(rdr, False) if form is eof: return result result = compile(form).invoke([])
def read_code(s): with with_ns(u"user"): return read(StringReader(unicode(s)), False)