parser and virtualmachine seem to be functional again in python 3
--HG-- branch : mung
This commit is contained in:
parent
25db8c81e0
commit
caf91bc0a8
11 changed files with 1438 additions and 1438 deletions
2
bi.py
2
bi.py
|
@ -102,7 +102,7 @@ builtin_map.update({
|
||||||
"""
|
"""
|
||||||
|
|
||||||
builtin_map.update({
|
builtin_map.update({
|
||||||
'serverlog': bi.serverlog,
|
b'serverlog': bi.serverlog,
|
||||||
})
|
})
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -6,7 +6,7 @@ import optimizer
|
||||||
|
|
||||||
|
|
||||||
def coerce(value):
|
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):
|
if isinstance(value, int):
|
||||||
return VMInteger(value)
|
return VMInteger(value)
|
||||||
elif isinstance(value, (tuple, list)):
|
elif isinstance(value, (tuple, list)):
|
||||||
|
|
|
@ -134,7 +134,7 @@ class Database(object):
|
||||||
i += 1
|
i += 1
|
||||||
break
|
break
|
||||||
|
|
||||||
def get_obj(self, objref):
|
def get_obj(self, objnum):
|
||||||
i = objnum
|
i = objnum
|
||||||
if i < len(self.objects):
|
if i < len(self.objects):
|
||||||
self.objects[i:] = []
|
self.objects[i:] = []
|
||||||
|
|
|
@ -30,7 +30,7 @@ def bytecode_flatten(l, ltypes=(list, tuple, ParseResults)):
|
||||||
if broken:
|
if broken:
|
||||||
continue
|
continue
|
||||||
assert not isinstance(l[i], ltypes)
|
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()
|
bc = l[i].bytecode()
|
||||||
if len(bc) > 1 or bc[0] != l[i]:
|
if len(bc) > 1 or bc[0] != l[i]:
|
||||||
l[i:i+1] = bc
|
l[i:i+1] = bc
|
||||||
|
|
|
@ -111,11 +111,11 @@ class VirtualMachine(object):
|
||||||
self.task.exc_stack.append(exc)
|
self.task.exc_stack.append(exc)
|
||||||
|
|
||||||
def pop(self, count=1):
|
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)]
|
return [x for x in reversed(stack)]
|
||||||
|
|
||||||
def pop_raw(self, count=1):
|
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)]
|
return [x for x in reversed(stack)]
|
||||||
|
|
||||||
def push(self, value):
|
def push(self, value):
|
||||||
|
|
Loading…
Add table
Reference in a new issue