Commits

Benoît Allard committed 4aa86bf

Correct parser

Comments (0)

Files changed (2)

+LEVELS := \
+levels/0-tutorials/0-cargo101.txt \
+levels/0-tutorials/1-transporter.txt \
+levels/0-tutorials/2-re-curses.txt \
+levels/0-tutorials/3-inverter.txt \
+levels/0-tutorials/4-from-beneath.txt \
+levels/0-tutorials/5-go-left.txt \
+levels/1-easy/0-double-flip.txt \
+levels/1-easy/1-go-left-2.txt \
+levels/1-easy/2-shuffle-sort.txt \
+levels/1-easy/3-go-the-distance.txt \
+levels/1-easy/4-color-sort.txt \
+levels/1-easy/5-walking-piles.txt \
+levels/2-medium/0-repeat-inverter.txt \
+levels/2-medium/1-double-sort.txt \
+levels/2-medium/2-mirror.txt \
+levels/2-medium/3-lay-it-out.txt \
+levels/2-medium/4-the-stacker.txt \
+levels/2-medium/5-clarity.txt \
+levels/3-hard/0-come-togther.txt \
+levels/3-hard/1-come-together-2.txt \
+levels/3-hard/2-up-the-greens.txt \
+levels/3-hard/3-fill-the-blanks.txt \
+levels/3-hard/4-count-the blues.txt \
+levels/3-hard/5-multi-sort.txt
+
+levels: $(LEVELS)
+
+levels/*/*.txt: prog-c
+	./$< $@
+
 prog-c: prog.py
 	python ../pypy/pypy/translator/goal/translate.py $<
     if docklen <= 0:
         raise ValueError('docklen not strictly positive: %d' % docklen)
     minreg = int(lines[2])
-    if lines[3] != '-': raise SyntaxError
+    if lines[3] != '-':
+        raise SyntaxError(lines[3])
     toolbox = lines[4:5]
-    if lines[5] != '-': raise SyntaxError
+    if lines[6] != '-':
+        raise SyntaxError(lines[6])
     init = lines[7:7+docklen]
-    if lines[7+docklen+1] != '-': raise SyntaxError
+    if lines[7+docklen] != '-':
+        raise SyntaxError(lines[7+docklen])
     goal = lines[7+docklen+1:7+docklen+1+docklen]
-    if lines[7+docklen+1+docklen+1] != '-': raise SyntaxError
+    if lines[7+docklen+1+docklen] != '-':
+        raise SyntaxError(lines[7+docklen+1+docklen])
     raw_code = lines[7+docklen+1+docklen+1:]
     code = []
     if len(raw_code) > 0: