projects
/
culture.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update.
[culture.git]
/
rpl.py
diff --git
a/rpl.py
b/rpl.py
index
b51edef
..
b848afa
100755
(executable)
--- a/
rpl.py
+++ b/
rpl.py
@@
-75,9
+75,9
@@
def generate(
result_stack = rpl_exec(prog, stack)
if len(result_stack) == 0:
no_empty_stack = False
result_stack = rpl_exec(prog, stack)
if len(result_stack) == 0:
no_empty_stack = False
- result = result + ["<in
put>"] + stack + ["<outp
ut>"] + result_stack
+ result = result + ["<in
>"] + stack + ["<o
ut>"] + result_stack
- result = result + ["<pr
o
g>"] + prog
+ result = result + ["<prg>"] + prog
result = result + ["<end>"]
if no_empty_stack and (
result = result + ["<end>"]
if no_empty_stack and (
@@
-103,11
+103,11
@@
def next_marker(seq, tokens, start=0):
def decompose(seq):
io = []
k = 0
def decompose(seq):
io = []
k = 0
- while seq[k] == "<in
put
>":
- o = next_marker(seq, ["<out
put
>"], start=k + 1)
+ while seq[k] == "<in>":
+ o = next_marker(seq, ["<out>"], start=k + 1)
if o is None:
raise ValueError("Missing output markers (should be correct in the prompt)")
if o is None:
raise ValueError("Missing output markers (should be correct in the prompt)")
- e = next_marker(seq, ["<in
put>", "<pro
g>"], start=o)
+ e = next_marker(seq, ["<in
>", "<pr
g>"], start=o)
if e is None:
raise ValueError(
"Missing input/output markers (should be correct in the prompt)"
if e is None:
raise ValueError(
"Missing input/output markers (should be correct in the prompt)"
@@
-123,14
+123,14
@@
def decompose(seq):
k = e
k = e
- if seq[k] == "<pr
o
g>":
+ if seq[k] == "<prg>":
e = next_marker(seq, ["<end>"], start=k)
if e is None:
prog = []
else:
prog = seq[k + 1 : e]
else:
e = next_marker(seq, ["<end>"], start=k)
if e is None:
prog = []
else:
prog = seq[k + 1 : e]
else:
- raise ValueError("Missing <pr
o
g> (it should be in the prompt)")
+ raise ValueError("Missing <prg> (it should be in the prompt)")
return prog, io
return prog, io