Commits

Anonymous committed b709224

Fix off-by-one in next-line-ing, and make CUTSHORT conform to spec.

  • Participants
  • Parent commits 924baa6

Comments (0)

Files changed (3)

File bin/SAWBONES

     elif stmt.type == 'Return':
         return ('return', 0)
     elif stmt.type == 'Cutshort':
+        if ring.is_empty():
+            return ('return', 0)
         ring.cutshort()
     elif stmt.type == 'DimRing':
         ring.dim(eval_expr(stmt.children[0], store))
         r = exec_line(line, store, ring, infile=infile, outfile=outfile)
         lines = Lines(prog, store)
         if r is None:
-            line_number = lines.seek_line_number(line_number + 1)
+            line_number = lines.seek_line_number(line_number)
             if line_number is None:
                 line_number = re_tu_rn()
                 if line_number is None:

File eg/cutshort2.sby

+100 PRINT "CUTSHORT WITH NOTHING ON THE CALL RING BUFFER ENDS THE PROGRAM, RIGHT?"
+101 CUTSHORT
+120 PRINT "RIGHT????"
+10 PRINT "`END` ENDS THE PROGRAM, RIGHT?"
+11 END
+12 PRINT "RIGHT????"