shithub: mc

Download patch

ref: d5ff76398f8fb87284ea7b26121bf1262aaaae25
parent: 1b2cc0844898436f599e9e967e0b93e64657fd50
author: Ori Bernstein <[email protected]>
date: Tue Oct 22 12:44:49 EDT 2013

Only increment the IP if we're not changing it.

--- a/interp.myr
+++ b/interp.myr
@@ -43,6 +43,7 @@
 		elif b != str[re.strp]
 			kill(re, tid, "not right char")
 		else
+			thr.ip++
 			std.put("\t\tmatched %b with %b\n", b, str[re.strp])
 		;;
 		;;
@@ -50,12 +51,16 @@
 		std.put("\t%i:\tRange (%b, %b)\t", thr.ip, start, end)
 		if !in(re, str) || start > str[re.strp] || end < str[re.strp]
 			kill(re, tid, "bad range")
+		else
+			thr.ip++
 		;;
 		;;
 	`Idot:
 		std.put("\t%i:\tDot\n", thr.ip)
-		if !in(re, str)
+		if in(re, str)
 			kill(re, tid, "past end")
+		else
+			thr.ip++
 		;;
 		;;
 	/*
@@ -64,8 +69,8 @@
 	 */
 	`Ifork	(lip, rip):
 		std.put("\t%i:\tFork (%z, %z)\n", thr.ip, rip, lip)
-		spawn(re, lip)
 		jmp(re, tid, rip)
+		spawn(re, lip)
 		;;
 	`Ijmp ip:
 		std.put("\t%i:\tJmp %z\n", thr.ip, ip)
@@ -76,12 +81,15 @@
 		finish(re, tid)
 		;;
 	;;
-	thr.ip++
 }
 
 const jmp = {re, tid, ip
 	re.thr[tid].ip = ip
 	step(re, tid)
+}
+
+const steptrace = {
+	std.put("\t\tStepping\n")
 }
 
 var uid = 0
--- a/main.myr
+++ b/main.myr
@@ -3,9 +3,9 @@
 
 const main = {
 	var found
-	match regex.compile("(a|b)")
+	match regex.compile("(a|b)*")
 	`std.Success re:
-		found = regex.exec(re, "b")
+		found = regex.exec(re, "babaas")
 		std.put("Found = %t: len = %z\n", found, re.strp)
 		-> 0
 		;;