Author: mhabersack
Date: 2007-03-01 08:57:18 -0500 (Thu, 01 Mar 2007)
New Revision: 73587

Modified:
   trunk/mcs/class/System.Web/System.Web.Compilation/AspParser.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
Log:
Fix for the asp parser

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/AspParser.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/AspParser.cs      
2007-03-01 13:08:04 UTC (rev 73586)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/AspParser.cs      
2007-03-01 13:57:18 UTC (rev 73587)
@@ -362,39 +362,41 @@
                }
 
                string GetVerbatim (int token, string end)
-               {
-                       StringBuilder vb_text = new StringBuilder ();
-                       int i = 0;
+                {
+                        StringBuilder vb_text = new StringBuilder ();
+                        int i = 0, i2 = 0;
 
-                       if (tokenizer.Value.Length > 1){
-                               // May be we have a put_back token that is not 
a single character
-                               vb_text.Append (tokenizer.Value);
-                               token = tokenizer.get_token ();
-                       }
+                        if (tokenizer.Value.Length > 1){
+                                // May be we have a put_back token that is not 
a single character
+                                vb_text.Append (tokenizer.Value);
+                                token = tokenizer.get_token ();
+                        }
 
-                       end = end.ToLower (CultureInfo.InvariantCulture);
-                       while (token != Token.EOF){
-                               if (Char.ToLower ((char) token, 
CultureInfo.InvariantCulture) == end [i]){
-                                       if (++i >= end.Length)
-                                               break;
-                                       token = tokenizer.get_token ();
-                                       continue;
-                               } else if (i > 0) {
-                                       for (int j = 0; j < i; j++)
-                                               vb_text.Append (end [j]);
-                                       i = 0;
-                               }
+                        end = end.ToLower (CultureInfo.InvariantCulture);
+                        while (token != Token.EOF){
+                                if (Char.ToLower ((char) token, 
CultureInfo.InvariantCulture) == end [i]){
+                                        i2++;
+                                        if (++i >= end.Length)
+                                                break;
+                                        token = tokenizer.get_token ();
+                                        continue;
+                                } else if (i > 0) {
+                                        if (i > 1)
+                                                i2 -= i;
+                                        for (int j = 0; j < i2; j++)
+                                                vb_text.Append (end [j]);
+                                        i2 = 0;
+                                }
+                                vb_text.Append ((char) token);
+                                token = tokenizer.get_token ();
+                        } 
 
-                               vb_text.Append ((char) token);
-                               token = tokenizer.get_token ();
-                       } 
+                        if (token == Token.EOF)
+                                OnError ("Expecting " + end + " and got EOF.");
 
-                       if (token == Token.EOF)
-                               OnError ("Expecting " + end + " and got EOF.");
+                        return RemoveComments (vb_text.ToString ());
+                }
 
-                       return RemoveComments (vb_text.ToString ());
-               }
-
                string RemoveComments (string text)
                {
                        int end;

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-03-01 
13:08:04 UTC (rev 73586)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-03-01 
13:57:18 UTC (rev 73587)
@@ -1,3 +1,10 @@
+2007-03-01  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * AspParser.cs: fix GetVerbatim for cases when the end is
+       e.g. --> or --%> and the string matched is ---> or ---%>
+       respectively. The new code always backs out to make sure the end is
+       matched correctly.
+
 2007-02-27  Marek Habersack  <[EMAIL PROTECTED]>
 
        * TemplateControlCompiler.cs: ParseExpression returns an object,

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

Reply via email to