Author: raja
Date: 2006-04-03 10:04:53 -0400 (Mon, 03 Apr 2006)
New Revision: 58954

Modified:
   trunk/mcs/class/System/System.Text.RegularExpressions/ChangeLog
   trunk/mcs/class/System/System.Text.RegularExpressions/interpreter.cs
Log:
* interpreter.cs (Eval) [Until, lazy]: Avoid extra evaluation on a
degenerate match.


Modified: trunk/mcs/class/System/System.Text.RegularExpressions/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Text.RegularExpressions/ChangeLog     
2006-04-03 13:54:26 UTC (rev 58953)
+++ trunk/mcs/class/System/System.Text.RegularExpressions/ChangeLog     
2006-04-03 14:04:53 UTC (rev 58954)
@@ -1,3 +1,8 @@
+2006-04-03  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * interpreter.cs (Eval) [Until, lazy]: Avoid extra evaluation on a
+       degenerate match.
+
 2006-03-30  Raja R Harinath  <[EMAIL PROTECTED]>
 
        Fix #77626

Modified: trunk/mcs/class/System/System.Text.RegularExpressions/interpreter.cs
===================================================================
--- trunk/mcs/class/System/System.Text.RegularExpressions/interpreter.cs        
2006-04-03 13:54:26 UTC (rev 58953)
+++ trunk/mcs/class/System/System.Text.RegularExpressions/interpreter.cs        
2006-04-03 14:04:53 UTC (rev 58954)
@@ -457,7 +457,7 @@
                                                ++ current.Count;
                                                current.Start = ptr;
                                                deep = current;
-                                               if (!Eval (Mode.Match, ref ptr, 
repeat.Expression)) {
+                                               if (!Eval (Mode.Match, ref ptr, 
current.Expression)) {
                                                        current.Start = start;
                                                        current.Count = 
start_count;
                                                        goto Fail;
@@ -466,7 +466,6 @@
                                                        goto Pass;
                                        }
 
-                                       DegenerateMatch:
                                        if (ptr == current.Start) {
                                                // degenerate match ... match 
tail or fail
                                                this.repeat = current.Previous;
@@ -501,9 +500,10 @@
                                                        }
                                                        if (deep != current)    
// recursive mode
                                                                goto Pass;
-                                                       // Degenerate match: no 
point retrying current.Expression if tail match fails
+                                                       // Degenerate match: 
ptr has not moved since the last (failed) tail match.
+                                                       // So, next and 
subsequent tail matches will fail.
                                                        if (ptr == 
current.Start)
-                                                               goto 
DegenerateMatch;
+                                                               goto Fail;
                                                }
                                        } else {
                                                int stack_size = stack.Count;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to