/// <summary> /// (BNF) value : [ any | block | ATKEYWORD S* ]+; /// (BNF) any : [ IDENT | NUMBER | PERCENTAGE | DIMENSION | STRING /// | DELIM | URI | HASH | UNICODE-RANGE | INCLUDES /// | FUNCTION S* any* ')' | DASHMATCH | '(' S* any* ')' /// | '[' S* any* ']' ] S*; /// </summary> /// <returns></returns> private CssValueList ParseValue() { CssValueList value = new CssValueList(); char ch; while (this.Read(out ch) && Char.IsWhiteSpace(ch)) { // skip whitespace, and empty declarations } switch (ch) { case '{': case ':': case ';': case '}': { throw new SyntaxError("Invalid char in CSS property value: '" + ch + "'", this.reader.FilePath, this.reader.Line, this.reader.Column); } } // read value, starting with current char int start = this.Position; while (this.Read(out ch)) { // consume declaration value switch (ch) { case '{': //case ':':// leave in for "filter: progid:DXImageTransform.Microsoft..." { throw new SyntaxError("Invalid CSS property value: " + this.Copy(start), this.reader.FilePath, this.reader.Line, this.reader.Column); } case '}': case ';': { //Should this parse the value further? CssString any = new CssString(); any.Value = this.Copy(start); value.Values.Add(any); if (ch == '}') { this.PutBack(); } return(value); } } } throw new UnexpectedEndOfFile("Unclosed declaration", this.reader.FilePath, this.reader.Line, this.reader.Column); }
/// <summary> /// (BNF) value : [ any | block | ATKEYWORD S* ]+; /// (BNF) any : [ IDENT | NUMBER | PERCENTAGE | DIMENSION | STRING /// | DELIM | URI | HASH | UNICODE-RANGE | INCLUDES /// | FUNCTION S* any* ')' | DASHMATCH | '(' S* any* ')' /// | '[' S* any* ']' ] S*; /// </summary> /// <returns></returns> private CssValueList ParseValue() { CssValueList value = new CssValueList(); char ch; while (this.Read(out ch) && Char.IsWhiteSpace(ch)) { // skip whitespace, and empty declarations } switch (ch) { case '{': case ':': case ';': case '}': { throw new SyntaxError("Invalid char in CSS property value: '" + ch + "'", this.reader.FilePath, this.reader.Line, this.reader.Column); } } // read value, starting with current char int start = this.Position; while (this.Read(out ch)) { // consume declaration value switch (ch) { case '{': //case ':':// leave in for "filter: progid:DXImageTransform.Microsoft..." { throw new SyntaxError("Invalid CSS property value: " + this.Copy(start), this.reader.FilePath, this.reader.Line, this.reader.Column); } case '}': case ';': { //Should this parse the value further? CssString any = new CssString(); any.Value = this.Copy(start); value.Values.Add(any); if (ch == '}') { this.PutBack(); } return value; } } } throw new UnexpectedEndOfFile("Unclosed declaration", this.reader.FilePath, this.reader.Line, this.reader.Column); }