nga-python: use Python int() function in override for s:to-number (#20)
FossilOrigin-Name: 27e48826a02a254fab1e4ecc342a8f78b8ab2dff5769b96ae85e5147b04338fd
This commit is contained in:
parent
97f1ad6319
commit
93290ac28d
1 changed files with 5 additions and 0 deletions
|
@ -51,6 +51,7 @@ class Retro:
|
|||
self.Cached["interpreter"] = self.map_in("interpret")
|
||||
self.Cached["not_found"] = self.map_in("err:notfound")
|
||||
self.Cached["s:eq?"] = self.map_in("s:eq?")
|
||||
self.Cached["s:to-number"] = self.map_in("s:to-number")
|
||||
self.Cached["d:lookup"] = self.map_in("d:lookup")
|
||||
|
||||
self.instructions = [
|
||||
|
@ -439,6 +440,10 @@ class Retro:
|
|||
self.stack.push(header)
|
||||
self.memory.store(header, self.Cached["d:lookup"] - 20) # "which"
|
||||
self.ip = self.address.pop()
|
||||
elif self.ip == self.Cached["s:to-number"]:
|
||||
n = self.extract_string(self.stack.pop())
|
||||
self.stack.push(int(n))
|
||||
self.ip = self.address.pop()
|
||||
else:
|
||||
if self.ip == notfound:
|
||||
print("ERROR: word not found!")
|
||||
|
|
Loading…
Reference in a new issue