Ejemplo n.º 1
0
    private StateResult Text()
    {
        var prev = '\0';

        while (!EndOfFile &&
               !(ParserHelpers.IsWhitespace(CurrentCharacter) || ParserHelpers.IsNewLine(CurrentCharacter)) &&
               !AtToken())
        {
            prev = CurrentCharacter;
            TakeCurrent();
        }

        if (CurrentCharacter == '@')
        {
            var next = Peek();
            if ((ParserHelpers.IsLetter(prev) || ParserHelpers.IsDecimalDigit(prev)) &&
                (ParserHelpers.IsLetter(next) || ParserHelpers.IsDecimalDigit(next)))
            {
                TakeCurrent();  // Take the "@"
                return(Stay()); // Stay in the Text state
            }
        }

        // Output the Text token and return to the Data state to tokenize the next character (if there is one)
        return(Transition(HtmlTokenizerState.Data, EndToken(SyntaxKind.Text)));
    }