1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
8 #include "core/css/parser/CSSParserToken.h"
9 #include "core/html/parser/InputStreamPreprocessor.h"
10 #include "wtf/text/WTFString.h"
16 class CSSTokenizerInputStream;
19 WTF_MAKE_NONCOPYABLE(CSSTokenizer);
20 WTF_MAKE_FAST_ALLOCATED;
22 static void tokenize(String, Vector<CSSParserToken>&);
24 CSSTokenizer(CSSTokenizerInputStream&);
26 CSSParserToken nextToken();
29 void consume(unsigned);
30 void reconsume(UChar);
32 CSSParserToken consumeNumericToken();
33 CSSParserToken consumeIdentLikeToken();
34 CSSParserToken consumeNumber();
35 CSSParserToken consumeStringTokenUntil(UChar);
36 CSSParserToken consumeUnicodeRange();
37 CSSParserToken consumeUrlToken();
39 void consumeBadUrlRemnants();
40 void consumeUntilNonWhitespace();
41 void consumeSingleWhitespaceIfNext();
42 bool consumeUntilCommentEndFound();
44 bool consumeIfNext(UChar);
46 UChar consumeEscape();
48 bool nextTwoCharsAreValidEscape();
49 bool nextCharsAreNumber(UChar);
50 bool nextCharsAreNumber();
51 bool nextCharsAreIdentifier(UChar);
52 bool nextCharsAreIdentifier();
53 CSSParserToken blockStart(CSSParserTokenType);
54 CSSParserToken blockStart(CSSParserTokenType blockType, CSSParserTokenType, String);
55 CSSParserToken blockEnd(CSSParserTokenType, CSSParserTokenType startType);
57 typedef CSSParserToken (CSSTokenizer::*CodePoint)(UChar);
59 static const CodePoint codePoints[];
60 Vector<CSSParserTokenType> m_blockStack;
62 CSSParserToken whiteSpace(UChar);
63 CSSParserToken leftParenthesis(UChar);
64 CSSParserToken rightParenthesis(UChar);
65 CSSParserToken leftBracket(UChar);
66 CSSParserToken rightBracket(UChar);
67 CSSParserToken leftBrace(UChar);
68 CSSParserToken rightBrace(UChar);
69 CSSParserToken plusOrFullStop(UChar);
70 CSSParserToken comma(UChar);
71 CSSParserToken hyphenMinus(UChar);
72 CSSParserToken asterisk(UChar);
73 CSSParserToken solidus(UChar);
74 CSSParserToken colon(UChar);
75 CSSParserToken semiColon(UChar);
76 CSSParserToken hash(UChar);
77 CSSParserToken reverseSolidus(UChar);
78 CSSParserToken asciiDigit(UChar);
79 CSSParserToken letterU(UChar);
80 CSSParserToken nameStart(UChar);
81 CSSParserToken stringStart(UChar);
82 CSSParserToken endOfFile(UChar);
84 CSSTokenizerInputStream& m_input;
91 #endif // CSSTokenizer_h