Exemplo n.º 1
0
        /// <summary>
        /// Creates a rule with the enumeration of tokens.
        /// </summary>
        public CssRule CreateRule(CssToken token)
        {
            switch (token.Type)
            {
            case CssTokenType.AtKeyword:
                return(CreateAtRule(token));

            case CssTokenType.CurlyBracketOpen:
                _tokenizer.RaiseErrorOccurred(CssParseError.InvalidBlockStart, token.Position);
                _tokenizer.SkipUnknownRule();
                return(null);

            case CssTokenType.String:
            case CssTokenType.Url:
            case CssTokenType.CurlyBracketClose:
            case CssTokenType.RoundBracketClose:
            case CssTokenType.SquareBracketClose:
                _tokenizer.RaiseErrorOccurred(CssParseError.InvalidToken, token.Position);
                _tokenizer.SkipUnknownRule();
                return(null);

            default:
                return(CreateStyle(token));
            }
        }
Exemplo n.º 2
0
 void RaiseErrorOccurred(CssParseError code, CssToken token)
 {
     _tokenizer.RaiseErrorOccurred(code, token.Position);
 }
Exemplo n.º 3
0
 void RaiseErrorOccurred(CssParseError code, TextPosition position)
 {
     _tokenizer.RaiseErrorOccurred(code, position);
 }