parser and virtualmachine seem to be functional again in python 3

--HG--
branch : mung
This commit is contained in:
cecilkorik 2019-04-23 17:34:40 -07:00
parent 25db8c81e0
commit caf91bc0a8
11 changed files with 1438 additions and 1438 deletions

2
bi.py
View file

@ -102,7 +102,7 @@ builtin_map.update({
"""
builtin_map.update({
'serverlog': bi.serverlog,
b'serverlog': bi.serverlog,
})
"""

View file

@ -6,7 +6,7 @@ import optimizer
def coerce(value):
from language_types import VMInteger, VMList, VMString, VMTable, VMObjRef, VMFloat, VMType
from language_types import ObjRef, VMInteger, VMList, VMString, VMTable, VMObjRef, VMFloat, VMType
if isinstance(value, int):
return VMInteger(value)
elif isinstance(value, (tuple, list)):

View file

@ -134,7 +134,7 @@ class Database(object):
i += 1
break
def get_obj(self, objref):
def get_obj(self, objnum):
i = objnum
if i < len(self.objects):
self.objects[i:] = []

View file

@ -30,7 +30,7 @@ def bytecode_flatten(l, ltypes=(list, tuple, ParseResults)):
if broken:
continue
assert not isinstance(l[i], ltypes)
assert not isinstance(l[i], (str, unicode, dict))
assert not isinstance(l[i], (str, bytes, dict))
bc = l[i].bytecode()
if len(bc) > 1 or bc[0] != l[i]:
l[i:i+1] = bc

View file

@ -111,11 +111,11 @@ class VirtualMachine(object):
self.task.exc_stack.append(exc)
def pop(self, count=1):
stack = [uncoerce(self.task.stack.pop()) for x in xrange(count)]
stack = [uncoerce(self.task.stack.pop()) for x in range(count)]
return [x for x in reversed(stack)]
def pop_raw(self, count=1):
stack = [self.task.stack.pop() for x in xrange(count)]
stack = [self.task.stack.pop() for x in range(count)]
return [x for x in reversed(stack)]
def push(self, value):