OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef MediaQueryTokenizer_h |
| 6 #define MediaQueryTokenizer_h |
| 7 |
| 8 #include "core/css/parser/MediaQueryToken.h" |
| 9 #include "core/html/parser/InputStreamPreprocessor.h" |
| 10 #include "wtf/text/WTFString.h" |
| 11 |
| 12 #include <climits> |
| 13 |
| 14 namespace WebCore { |
| 15 |
| 16 class MediaQueryInputStream; |
| 17 |
| 18 class MediaQueryTokenizer { |
| 19 WTF_MAKE_NONCOPYABLE(MediaQueryTokenizer); |
| 20 WTF_MAKE_FAST_ALLOCATED; |
| 21 public: |
| 22 static void tokenize(String, Vector<MediaQueryToken>&); |
| 23 |
| 24 private: |
| 25 class CodePoints; |
| 26 |
| 27 MediaQueryTokenizer(MediaQueryInputStream&); |
| 28 |
| 29 MediaQueryToken nextToken(); |
| 30 |
| 31 UChar consume(); |
| 32 void consume(unsigned); |
| 33 void reconsume(UChar); |
| 34 |
| 35 MediaQueryToken consumeNumericToken(); |
| 36 MediaQueryToken consumeIdentLikeToken(); |
| 37 MediaQueryToken consumeNumber(); |
| 38 |
| 39 void consumeUntilNonWhitespace(); |
| 40 |
| 41 bool consumeIfNext(UChar); |
| 42 String consumeName(); |
| 43 UChar consumeEscape(); |
| 44 |
| 45 bool nextTwoCharsAreValidEscape(); |
| 46 bool nextCharsAreNumber(); |
| 47 bool nextCharsAreIdentifier(); |
| 48 |
| 49 typedef MediaQueryToken (MediaQueryTokenizer::*CodePoint)(UChar); |
| 50 |
| 51 MediaQueryToken whiteSpace(UChar); |
| 52 MediaQueryToken leftParenthesis(UChar); |
| 53 MediaQueryToken rightParenthesis(UChar); |
| 54 MediaQueryToken plusOrFullStop(UChar); |
| 55 MediaQueryToken comma(UChar); |
| 56 MediaQueryToken hyphenMinus(UChar); |
| 57 MediaQueryToken solidus(UChar); |
| 58 MediaQueryToken colon(UChar); |
| 59 MediaQueryToken semiColon(UChar); |
| 60 MediaQueryToken reverseSolidus(UChar); |
| 61 MediaQueryToken asciiDigit(UChar); |
| 62 MediaQueryToken nameStart(UChar); |
| 63 MediaQueryToken endOfFile(UChar); |
| 64 |
| 65 CodePoints* codePoints(); |
| 66 |
| 67 MediaQueryInputStream& m_input; |
| 68 }; |
| 69 |
| 70 |
| 71 |
| 72 } // namespace WebCore |
| 73 |
| 74 #endif // MediaQueryTokenizer_h |
OLD | NEW |