shithub: mc

Download patch

ref: 885ddee11e81c48af3ddf43f4682aad5ab729e7a
parent: a6ba17d4905ac66f9b96843b1cfa8b6981b096f1
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Jun 12 07:21:06 EDT 2015

Unreverse match order.

    We got the match group ordering wrong. Oops.

--- a/libregex/compile.myr
+++ b/libregex/compile.myr
@@ -550,7 +550,7 @@
 }
 
 const baseexpr = {re
-	var ret
+	var ret, m
 
 	if re.pat.len == 0
 		-> `None
@@ -567,11 +567,12 @@
 	| '^':	getc(re); ret = mk(`Bol)
 	| '$':	getc(re); ret = mk(`Eol)
 	| '(':	
+		m = re.nmatch++
 		getc(re)
 		match altexpr(re)
 		| `Some s:
 			if matchc(re, ')')
-				-> `Some mk(`Cap (re.nmatch++, s))
+				-> `Some mk(`Cap (m, s))
 			else
 				-> `Fail `Unbalanced
 			;;
--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -144,7 +144,7 @@
 			;;
 		| `Local (l, lnum):
 			if !std.hassuffix(l, ".use")
-				std.fatal("%s:%s: local dependency \"%s\" should end with .use\n", path, lnum, l)
+				std.f2fatal("{}:{}: local dependency \"{}\" should end with .use\n", path, lnum, l)
 			;;
 			if obj.len != 0
 				pushdep(g, l, obj)
@@ -288,9 +288,9 @@
 	match regex.exec(usepat, ln)
 	| `std.Some uses:
 		if uses[2].len > 0
-			deps = std.slpush(deps, `Local (std.sldup(uses[2]), lnum))
+			deps = std.slpush(deps, `Lib (std.sldup(uses[2]), lnum))
 		else
-			deps = std.slpush(deps, `Lib (std.sldup(uses[4]), lnum))
+			deps = std.slpush(deps, `Local (std.sldup(uses[3]), lnum))
 		;;
 	| `std.None:
 		/* nothing to do */
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -73,7 +73,7 @@
 		bld.opt_incpaths = std.slpush(bld.opt_incpaths, libpath)
 	;;
 
-	match regex.compile("^\\s*use\\s+((\\<\\S+\\>)|(\"(\\S+)\")).*")
+	match regex.compile("^\\s*use\\s+((\\<\\S+\\>)|\"(\\S+)\").*")
 	| `std.Ok re:	bld.usepat = re
 	| `std.Fail f:	std.fatal("Failed to compile use pattern regex\n")
 	;;