Beispiel #1
0
		TagAttributes GetAttributes ()
		{
			int token;
			TagAttributes attributes;
			string id;
			bool wellFormedForServer = true;

			attributes = new TagAttributes ();
			while ((token = tokenizer.get_token ()) != Token.EOF)
			{
				if (token == '<' && Eat ('%')) 
				{
					tokenizer.Verbatim = true;
					attributes.Add ("", "<%" + 
						GetVerbatim (tokenizer.get_token (), "%>") + "%>");
					tokenizer.Verbatim = false;
					tokenizer.InTag = true;
					continue;
				}
					
				if (token != Token.IDENTIFIER)
					break;

				id = tokenizer.Value;
				if (Eat ('='))
				{
					if (Eat (Token.ATTVALUE))
					{
						attributes.Add (id, tokenizer.Value);
						wellFormedForServer &= tokenizer.AlternatingQuotes;
					} 
					else if (Eat ('<') && Eat ('%')) 
					{
						/*
						TagType tagtypeTmp = TagType.ServerComment;
						string idTmp = null;
						TagAttributes attributesTmp = new TagAttributes ();
						GetServerTag (out tagtypeTmp, out idTmp, out attributesTmp);
						OnTagParsed (tagtypeTmp, idTmp, attributesTmp);
						*/
						tokenizer.Verbatim = true;
						attributes.Add (id, "<%" + 
							GetVerbatim (tokenizer.get_token (), "%>") + "%>");
						tokenizer.Verbatim = false;
						tokenizer.InTag = true;
					} 
					else 
					{
						OnError ("expected ATTVALUE");
						return null;
					}
				} 
				else 
				{
					attributes.Add (id, null);
				}
			}

			tokenizer.put_back ();

			if (attributes.IsRunAtServer () && !wellFormedForServer) 
			{
				OnError ("The server tag is not well formed.");
				return null;
			}
			
			return attributes;
		}
Beispiel #2
0
        TagAttributes GetAttributes()
        {
            int           token;
            TagAttributes attributes;
            string        id;
            bool          wellFormedForServer = true;

            attributes = new TagAttributes();
            while ((token = tokenizer.get_token()) != Token.EOF)
            {
                if (token == '<' && Eat('%'))
                {
                    tokenizer.Verbatim = true;
                    attributes.Add("", "<%" +
                                   GetVerbatim(tokenizer.get_token(), "%>") + "%>");
                    tokenizer.Verbatim = false;
                    tokenizer.InTag    = true;
                    continue;
                }

                if (token != Token.IDENTIFIER)
                {
                    break;
                }

                id = tokenizer.Value;
                if (Eat('='))
                {
                    if (Eat(Token.ATTVALUE))
                    {
                        attributes.Add(id, tokenizer.Value);
                        wellFormedForServer &= tokenizer.AlternatingQuotes;
                    }
                    else if (Eat('<') && Eat('%'))
                    {
                        /*
                         * TagType tagtypeTmp = TagType.ServerComment;
                         * string idTmp = null;
                         * TagAttributes attributesTmp = new TagAttributes ();
                         * GetServerTag (out tagtypeTmp, out idTmp, out attributesTmp);
                         * OnTagParsed (tagtypeTmp, idTmp, attributesTmp);
                         */
                        tokenizer.Verbatim = true;
                        attributes.Add(id, "<%" +
                                       GetVerbatim(tokenizer.get_token(), "%>") + "%>");
                        tokenizer.Verbatim = false;
                        tokenizer.InTag    = true;
                    }
                    else
                    {
                        OnError("expected ATTVALUE");
                        return(null);
                    }
                }
                else
                {
                    attributes.Add(id, null);
                }
            }

            tokenizer.put_back();

            if (attributes.IsRunAtServer() && !wellFormedForServer)
            {
                OnError("The server tag is not well formed.");
                return(null);
            }

            return(attributes);
        }