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 (String.Empty, "<%" +
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 ('%')) {
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;
}