Jelajahi Sumber

2004-01-16 Gonzalo Paniagua Javier <[email protected]>

	* System.Text.RegularExpressions/parser.cs: an opening brace without a
	quantifier do not cause a parse error. Fixes bug #52924.
	* Test/System.Text.RegularExpressions/RegexBugs.cs: added test from
	bug #52924.

svn path=/trunk/mcs/; revision=22160
Gonzalo Paniagua Javier 22 tahun lalu
induk
melakukan
b0c1b57ccf

+ 5 - 0
mcs/class/System/System.Text.RegularExpressions/ChangeLog

@@ -1,3 +1,8 @@
+2004-01-16  Gonzalo Paniagua Javier <[email protected]>
+
+	* parser.cs: an opening brace without a
+	quantifier do not cause a parse error. Fixes bug #52924.
+
 2004-01-07  Lluis Sanchez Gual <[email protected]>
 
 	* regex.cs: In Split(), if the last match is at the end of the string, 

+ 1 - 1
mcs/class/System/System.Text.RegularExpressions/parser.cs

@@ -247,7 +247,7 @@ namespace System.Text.RegularExpressions.Syntax {
 					continue;
 				}
 
-				case '*': case '+': case '?': case '{': {
+				case '*': case '+': case '?': {
 					throw NewParseException ("Bad quantifier.");
 				}
 

+ 7 - 2
mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog

@@ -1,7 +1,12 @@
+2004-01-16  Gonzalo Paniagua Javier <[email protected]>
+
+	* RegexBugs.cs: added test from bug #52924.
+
 2004-01-07  Lluis Sanchez Gual <[email protected]>
 
-	* RegexBugs.cs: Improved test. In Split(), if the last match is at the end
-	of the string, an empty string must be added to the array of results.
+	* RegexBugs.cs: Improved test. In Split(), if the last match is at the
+	end of the string, an empty string must be added to the array of
+	results.
 
 2003-11-27  Gonzalo Paniagua Javier <[email protected]>
 

+ 9 - 0
mcs/class/System/Test/System.Text.RegularExpressions/RegexBugs.cs

@@ -70,5 +70,14 @@ namespace MonoTests.System.Text.RegularExpressions
 			AssertEquals ("MEG #12", true, Regex.IsMatch(str, @"(something|dog|)*$"));
 
 		}
+
+		[Test]
+		public void Braces () // bug 52924
+		{
+			// Before the fix, the next line throws an exception
+			Regex regVar = new Regex(@"{\w+}");
+			Match m = regVar.Match ("{   }");
+			AssertEquals ("BR #01", false, m.Success);
+		}
 	}
 }