projects
/
picoclvr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cd5e464
)
Update.
author
François Fleuret
<francois@fleuret.org>
Thu, 20 Jul 2023 15:34:42 +0000
(17:34 +0200)
committer
François Fleuret
<francois@fleuret.org>
Thu, 20 Jul 2023 15:34:42 +0000
(17:34 +0200)
rpl.py
patch
|
blob
|
history
diff --git
a/rpl.py
b/rpl.py
index
8d31efe
..
f826fc4
100755
(executable)
--- a/
rpl.py
+++ b/
rpl.py
@@
-107,13
+107,17
@@
def decompose(seq):
o = next_marker(seq, ["<output>"], start=k + 1)
e = next_marker(seq, ["<input>", "<prog>"], start=o)
if o is None or e is None:
o = next_marker(seq, ["<output>"], start=k + 1)
e = next_marker(seq, ["<input>", "<prog>"], start=o)
if o is None or e is None:
- raise ValueError("Invalid input/output")
+ raise ValueError(
+ "Missing input/output markers (should be correct in the prompt)"
+ )
try:
io.append(
([int(x) for x in seq[k + 1 : o]], [int(x) for x in seq[o + 1 : e]])
)
except ValueError:
try:
io.append(
([int(x) for x in seq[k + 1 : o]], [int(x) for x in seq[o + 1 : e]])
)
except ValueError:
- raise ValueError("Invalid input/output")
+ raise ValueError(
+ "Invalid input/output value (should be correct in the prompt)"
+ )
k = e
k = e
@@
-123,6
+127,9
@@
def decompose(seq):
prog = []
else:
prog = seq[k + 1 : e]
prog = []
else:
prog = seq[k + 1 : e]
+ else:
+ raise ValueError("Missing <prog> (it should be in the prompt)")
+
return prog, io
return prog, io