mirror of
https://github.com/nineties/planckforth
synced 2024-12-26 21:58:42 +01:00
exit at EOF (python-version)
This commit is contained in:
parent
f29471fb7c
commit
b08c087aaf
1 changed files with 7 additions and 1 deletions
|
@ -137,7 +137,13 @@ add_simple_operator('Q', lambda: exit(0))
|
|||
add_simple_operator('C', lambda: push(CELL))
|
||||
add_simple_operator('h', lambda: push(HERE_CELL))
|
||||
add_simple_operator('l', lambda: push(LATEST_CELL))
|
||||
add_simple_operator('k', lambda: push(ord(sys.stdin.read(1))))
|
||||
def key():
|
||||
c = sys.stdin.read(1)
|
||||
if c:
|
||||
push(ord(c))
|
||||
else:
|
||||
exit(0)
|
||||
add_simple_operator('k', key)
|
||||
add_simple_operator('t', lambda: sys.stdout.write(chr(pop())))
|
||||
add_operator('j', lambda ip,np: next(np + read(np)))
|
||||
add_operator('J', lambda ip,np: next(np + (CELL if pop() else read(np))))
|
||||
|
|
Loading…
Reference in a new issue