浏览代码

Fixed inverted group thrown off by quantifiers

Zher Huei Lee 8 年之前
父节点
当前提交
f01ce3276e
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      modules/regex/regex.cpp

+ 4 - 3
modules/regex/regex.cpp

@@ -603,10 +603,8 @@ struct RegExNodeGroup : public RegExNode {
 
 			int res = childset[i]->test(s, pos);
 
-			if (s.complete)
-				return res;
-
 			if (inverse) {
+				s.complete = false;
 				if (res < 0)
 					res = pos + 1;
 				else
@@ -616,6 +614,9 @@ struct RegExNodeGroup : public RegExNode {
 					continue;
 			}
 
+			if (s.complete)
+				return res;
+
 			if (res >= 0) {
 				if (reset_pos)
 					res = pos;