/// <summary> /// This must be called at the start of any @directive's Parse() function. /// It fills in the "At" and "Keyword" variables. /// "Keyword" could end up being null, but "At" is always set. /// </summary> protected virtual void ParseAtAndKeyword(ItemFactory itemFactory, ITextProvider text, TokenStream tokens) { Debug.Assert(tokens.CurrentToken.TokenType == CssTokenType.At); At = Children.AddCurrentAndAdvance(tokens, CssClassifierContextType.AtDirectiveName); if (tokens.CurrentToken.Start == At.AfterEnd && tokens.CurrentToken.TokenType == CssTokenType.At && AllowDoubleAt(text)) { // Two @'s in a row (@@directive). Ignore the first one for Razor support. At = Children.AddCurrentAndAdvance(tokens, CssClassifierContextType.AtDirectiveName); } // Check for the directive name if (tokens.CurrentToken.Start == At.AfterEnd && tokens.CurrentToken.TokenType == CssTokenType.Identifier) { Keyword = Children.AddCurrentAndAdvance(tokens, CssClassifierContextType.AtDirectiveName); } else { At.AddParseError(ParseErrorType.AtDirectiveNameMissing, ParseErrorLocation.AfterItem); } }