shithub: mc

Download patch

ref: 831925aa6419d2901f32b648afb8e38836d19bea
parent: 27801bffb5e80b5dcf1b3c9d1cabc4c8d9c9c4aa
author: Ori Bernstein <[email protected]>
date: Sat May 31 13:56:05 EDT 2014

Port from std.error to std.result.

--- a/compile.myr
+++ b/compile.myr
@@ -4,8 +4,8 @@
 use "ranges.use"
 
 pkg regex =
-	const compile	: (re : byte[:] -> std.error(regex#, status))
-	const dbgcompile	: (re : byte[:] -> std.error(regex#, status))
+	const compile	: (re : byte[:] -> std.result(regex#, status))
+	const dbgcompile	: (re : byte[:] -> std.result(regex#, status))
 	const free	: (re : regex# -> void)
 ;;
 
@@ -57,8 +57,8 @@
 	re.pat = pat
 	re.nmatch = 1 /* whole match */
 	match parse(re)
-	| `None:	-> `std.Failure (`Earlystop)
-	| `Fail f:	-> `std.Failure f
+	| `None:	-> `std.Fail (`Earlystop)
+	| `Fail f:	-> `std.Fail f
 	| `Some t:
 		/*
 		we can stop early if we get 
@@ -65,7 +65,7 @@
 		an incorrectly encoded char
 		*/
 		if re.pat.len > 0
-			-> `std.Failure (`Earlystop)
+			-> `std.Fail (`Earlystop)
 		;;
 		dump(re, t, 0)
 		append(re, `Ilbra 0)
@@ -74,9 +74,9 @@
 		append(re, `Imatch)
 		idump(re)
 		astfree(t)
-		-> `std.Success re
+		-> `std.Ok re
 	;;
-	-> `std.Failure (`Noimpl)
+	-> `std.Fail (`Noimpl)
 }
 
 const free = {re
--- a/test/testmatch.myr
+++ b/test/testmatch.myr
@@ -17,7 +17,7 @@
 const run = {regex, pat, text
 	var i
 	match regex
-	| `std.Success re:
+	| `std.Ok re:
 		match regex.exec(re, text)
 		| `std.Some m:
 			std.put("Matched %s via %s : %i\n", text, pat, m.len)
@@ -28,7 +28,7 @@
 			std.put("No match of %s via %s\n", text, pat)
 		;;
 		regex.free(re)
-	| `std.Failure err:
+	| `std.Fail err:
 		std.put("failed to compile regex")
 	;;
 }