shithub: mc

Download patch

ref: 06751256b59bce18a2c12b1430743ce2d19d6b15
parent: 89a6bb636fa090508923997f2a3591f0ef63cf04
author: Ori Bernstein <[email protected]>
date: Wed Jan 29 15:48:34 EST 2014

Add more syntaxes for uncode regexes.

--- a/interp.myr
+++ b/interp.myr
@@ -207,9 +207,18 @@
 }
 
 const die = {re, thr, msg
+        /*
+ 	  we can have die called on a thread
+	  multiple times, eg, if it has a bad
+	  range *and* end in a state that another
+	  thread is in. We should only decrement
+	  the number of threads for that once.
+	 */
 	trace(re, thr, "\t\tdie %z: %s\n", thr.tid, msg)
+        if !thr.dead
+		re.nthr--
+        ;;
 	thr.dead = true
-	re.nthr--
 }
 
 const finish = {re, thr
--- a/test/data/regex-unicode-expected
+++ b/test/data/regex-unicode-expected
@@ -3,3 +3,9 @@
 Matched Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! via (\p{L}*)bæc\P{L}* : 2
 	match 0: Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 	match 1: Aa
+Matched Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! via (\pL*)bæc\PL* : 2
+	match 0: Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+	match 1: Aa
+Matched Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! via (\p{Letter}*)bæc\P{Uppercase_Letter}* : 2
+	match 0: Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+	match 1: Aa
--- a/test/regex-unicode.myr
+++ b/test/regex-unicode.myr
@@ -6,4 +6,7 @@
 const main = {
 	testmatch(".*bæc", "Abæc")
 	testmatch("(\\p{L}*)bæc\\P{L}*", "Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
+        /* test various syntaxen */
+	testmatch("(\\pL*)bæc\\PL*", "Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
+	testmatch("(\\p{Letter}*)bæc\\P{Uppercase_Letter}*", "Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
 }