shithub: mc

Download patch

ref: 530ed98bad8ebbc5448fdd897e7c6aa801f36d98
parent: 46fa16a5b71dac736cccd372bf82d33aff913f70
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Dec 28 11:31:11 EST 2013

Revert "remove 'in' function."

This reverts commit 972b52f65248e3fb498069676c4f4707f4eb9457.

--- a/interp.myr
+++ b/interp.myr
@@ -95,7 +95,7 @@
 	/* Char matching. Consume exactly one byte from the string. */
 	| `Ibyte b:
 		trace(re, thr, "\t%z:\tByte %b (%c)\n", thr.ip, b, b castto(char))
-		if re.strp >- str.len
+		if !in(re, str)
 			die(re, thr, "end of string")
 		elif b != str[re.strp]
 			die(re, thr, "not right char")
@@ -105,7 +105,7 @@
 		;;
 	| `Irange (start, end):
 		trace(re, thr, "\t%z:\tRange (%b, %b)\n", thr.ip, start, end)
-		if re.strp >= str.len || start > str[re.strp] || end < str[re.strp]
+		if !in(re, str) || start > str[re.strp] || end < str[re.strp]
 			die(re, thr, "bad range")
 		else
 			thr.ip++
@@ -220,6 +220,10 @@
 	std.slfree(thr.mstart)
 	std.slfree(thr.mend)
 	std.free(thr)
+}
+
+const in = {re, str 
+	-> re.strp < str.len
 }
 
 const trace : (re : regex#, thr : rethread#, msg : byte[:], args : ...) = {re, thr, msg, args
--