1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CSSTokenizer_h
#define CSSTokenizer_h
#include "core/css/parser/CSSParserToken.h"
#include "core/html/parser/InputStreamPreprocessor.h"
#include "wtf/text/WTFString.h"
#include <climits>
namespace blink {
class CSSTokenizerInputStream;
class CSSTokenizer {
WTF_MAKE_NONCOPYABLE(CSSTokenizer);
WTF_MAKE_FAST_ALLOCATED;
public:
static void tokenize(String, Vector<CSSParserToken>&);
private:
CSSTokenizer(CSSTokenizerInputStream&);
CSSParserToken nextToken();
UChar consume();
void consume(unsigned);
void reconsume(UChar);
CSSParserToken consumeNumericToken();
CSSParserToken consumeIdentLikeToken();
CSSParserToken consumeNumber();
CSSParserToken consumeStringTokenUntil(UChar);
CSSParserToken consumeUnicodeRange();
CSSParserToken consumeUrlToken();
void consumeBadUrlRemnants();
void consumeUntilNonWhitespace();
void consumeSingleWhitespaceIfNext();
bool consumeUntilCommentEndFound();
bool consumeIfNext(UChar);
String consumeName();
UChar consumeEscape();
bool nextTwoCharsAreValidEscape();
bool nextCharsAreNumber(UChar);
bool nextCharsAreNumber();
bool nextCharsAreIdentifier(UChar);
bool nextCharsAreIdentifier();
CSSParserToken blockStart(CSSParserTokenType);
CSSParserToken blockStart(CSSParserTokenType blockType, CSSParserTokenType, String);
CSSParserToken blockEnd(CSSParserTokenType, CSSParserTokenType startType);
typedef CSSParserToken (CSSTokenizer::*CodePoint)(UChar);
static const CodePoint codePoints[];
Vector<CSSParserTokenType> m_blockStack;
CSSParserToken whiteSpace(UChar);
CSSParserToken leftParenthesis(UChar);
CSSParserToken rightParenthesis(UChar);
CSSParserToken leftBracket(UChar);
CSSParserToken rightBracket(UChar);
CSSParserToken leftBrace(UChar);
CSSParserToken rightBrace(UChar);
CSSParserToken plusOrFullStop(UChar);
CSSParserToken comma(UChar);
CSSParserToken hyphenMinus(UChar);
CSSParserToken asterisk(UChar);
CSSParserToken solidus(UChar);
CSSParserToken colon(UChar);
CSSParserToken semiColon(UChar);
CSSParserToken hash(UChar);
CSSParserToken circumflexAccent(UChar);
CSSParserToken dollarSign(UChar);
CSSParserToken verticalLine(UChar);
CSSParserToken tilde(UChar);
CSSParserToken commercialAt(UChar);
CSSParserToken reverseSolidus(UChar);
CSSParserToken asciiDigit(UChar);
CSSParserToken letterU(UChar);
CSSParserToken nameStart(UChar);
CSSParserToken stringStart(UChar);
CSSParserToken endOfFile(UChar);
CSSTokenizerInputStream& m_input;
};
} // namespace blink
#endif // CSSTokenizer_h
|