Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2004-10-29 08:21:46 +0400
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2004-10-29 08:21:46 +0400
commit616aa26986db6d6e0330287bde92af54de435236 (patch)
tree97a46ae36e583c92c47ca8525024abe480cf599a
parent545ce9502d0404b6cd825480d0666ffa84e6ffbe (diff)
from HEAD
svn path=/branches/mono-1-0/mcs/; revision=35425
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs94
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspParser.cs5
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs9
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/ChangeLog10
4 files changed, 110 insertions, 8 deletions
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
index a24439fc10b..d21312dd433 100644
--- a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
@@ -34,6 +34,7 @@ using System.IO;
using System.Text;
using System.Web.Caching;
using System.Web.UI;
+using System.Web.UI.HtmlControls;
using System.Web.Util;
namespace System.Web.Compilation
@@ -127,7 +128,46 @@ namespace System.Web.Compilation
get { return current.Filename; }
}
}
-
+
+ class TagStack
+ {
+ Stack tags;
+
+ public TagStack ()
+ {
+ tags = new Stack ();
+ }
+
+ public void Push (string tagid)
+ {
+ tags.Push (tagid);
+ }
+
+ public string Pop ()
+ {
+ if (tags.Count == 0)
+ return null;
+
+ return (string) tags.Pop ();
+ }
+
+ public bool CompareTo (string tagid)
+ {
+ if (tags.Count == 0)
+ return false;
+
+ return 0 == String.Compare (tagid, (string) tags.Peek (), true);
+ }
+
+ public int Count {
+ get { return tags.Count; }
+ }
+
+ public string Current {
+ get { return (string) tags.Peek (); }
+ }
+ }
+
class AspGenerator
{
ParserStack pstack;
@@ -140,6 +180,8 @@ namespace System.Web.Compilation
bool isApplication;
StringBuilder tagInnerText = new StringBuilder ();
static Hashtable emptyHash = new Hashtable ();
+ bool inForm;
+ TagStack formTags;
public AspGenerator (TemplateParser tparser)
{
@@ -284,12 +326,22 @@ namespace System.Web.Compilation
tparser.AddDirective (tagid, attributes.GetDictionary (null));
break;
case TagType.Tag:
- if (!ProcessTag (tagid, attributes, tagtype))
- TextParsed (location, location.PlainText);
+ if (ProcessTag (tagid, attributes, tagtype))
+ break;
+
+ if (inForm) {
+ stack.Builder.EnsureOtherTags ();
+ stack.Builder.OtherTags.Add (tagid);
+ }
+
+ TextParsed (location, location.PlainText);
break;
case TagType.Close:
- if (!CloseControl (tagid))
- TextParsed (location, location.PlainText);
+ bool notServer = (inForm && TryRemoveTag (tagid, stack.Builder.OtherTags));
+ if (!notServer && CloseControl (tagid))
+ break;
+
+ TextParsed (location, location.PlainText);
break;
case TagType.SelfClosing:
int count = stack.Count;
@@ -333,6 +385,20 @@ namespace System.Web.Compilation
//PrintLocation (location);
}
+ static bool TryRemoveTag (string tagid, ArrayList otags)
+ {
+ if (otags == null || otags.Count == 0)
+ return false;
+
+ int idx = otags.Count - 1;
+ string otagid = (string) otags [idx];
+ if (0 != String.Compare (tagid, otagid, true))
+ return false;
+
+ otags.RemoveAt (idx);
+ return true;
+ }
+
static string GetIncludeFilePath (string basedir, string filename)
{
if (Path.DirectorySeparatorChar == '/')
@@ -422,6 +488,14 @@ namespace System.Web.Compilation
builder.location = location;
builder.ID = htable ["id"] as string;
+ if (typeof (HtmlForm).IsAssignableFrom (builder.ControlType)) {
+ if (inForm)
+ throw new ParseException (location, "Only one <form> allowed.");
+
+ inForm = true;
+ formTags = new TagStack ();
+ }
+
if (builder.HasBody () && !(builder is ObjectTagBuilder)) {
if (builder is TemplateBuilder) {
// push the id list
@@ -459,8 +533,10 @@ namespace System.Web.Compilation
return true;
} else {
- Parser.VerbatimID = "script";
- javascript = true;
+ if (tagtype != TagType.SelfClosing) {
+ Parser.VerbatimID = "script";
+ javascript = true;
+ }
TextParsed (location, location.PlainText);
return true;
}
@@ -508,6 +584,10 @@ namespace System.Web.Compilation
tagInnerText.Length = 0;
}
+ if (typeof (HtmlForm).IsAssignableFrom (current.ControlType)) {
+ inForm = false;
+ }
+
current.CloseControl ();
stack.Pop ();
stack.Builder.AppendSubBuilder (current);
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspParser.cs b/mcs/class/System.Web/System.Web.Compilation/AspParser.cs
index 28c357ce3c5..7922b830d20 100644
--- a/mcs/class/System.Web/System.Web.Compilation/AspParser.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/AspParser.cs
@@ -382,8 +382,11 @@ namespace System.Web.Compilation
void GetServerTag (out TagType tagtype, out string id, out TagAttributes attributes)
{
string inside_tags;
+ bool old = tokenizer.ExpectAttrValue;
+ tokenizer.ExpectAttrValue = false;
if (Eat ('@')){
+ tokenizer.ExpectAttrValue = old;
tagtype = TagType.Directive;
id = "";
if (Eat (Token.DIRECTIVE))
@@ -397,6 +400,7 @@ namespace System.Web.Compilation
}
if (Eat (Token.DOUBLEDASH)) {
+ tokenizer.ExpectAttrValue = old;
tokenizer.Verbatim = true;
inside_tags = GetVerbatim (tokenizer.get_token (), "--%>");
tokenizer.Verbatim = false;
@@ -406,6 +410,7 @@ namespace System.Web.Compilation
return;
}
+ tokenizer.ExpectAttrValue = old;
bool varname;
bool databinding;
varname = Eat ('=');
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs b/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs
index d04074fe780..231c7236a84 100644
--- a/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/AspTokenizer.cs
@@ -55,6 +55,7 @@ namespace System.Web.Compilation
int begcol, begline;
int position;
bool inTag;
+ bool expectAttrValue;
bool hasPutBack;
bool verbatim;
bool have_value;
@@ -210,7 +211,7 @@ namespace System.Web.Compilation
return c;
}
- if (inTag && (c == '"' || c == '\''))
+ if (inTag && expectAttrValue && (c == '"' || c == '\''))
return ReadAttValue (c);
if (c == '<'){
@@ -298,6 +299,12 @@ namespace System.Web.Compilation
get { return inTag; }
set { inTag = value; }
}
+
+ // Hack for preventing confusion with VB comments (see bug #63451)
+ public bool ExpectAttrValue {
+ get { return expectAttrValue; }
+ set { expectAttrValue = value; }
+ }
public int BeginLine {
get { return begline; }
diff --git a/mcs/class/System.Web/System.Web.Compilation/ChangeLog b/mcs/class/System.Web/System.Web.Compilation/ChangeLog
index 64f5b411b2f..7dbcbfba4b2 100644
--- a/mcs/class/System.Web/System.Web.Compilation/ChangeLog
+++ b/mcs/class/System.Web/System.Web.Compilation/ChangeLog
@@ -1,8 +1,18 @@
+2004-10-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: correctly process script tags that self-closing.
+ Fixes bug #69657.
+
2004-10-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* CachingCompiler.cs: when compiling a single .cs file, add the file
itself to dependencies. Fixes bug #68788.
+2004-09-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ControlBuilder.cs: don't close server tags when we get to a closing
+ tag that is not applied to a server control. Fixes bug #60323.
+
2004-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* WebServiceCompiler.cs: fix buglet in my last commit.