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 MediaQueryTokenizer(); |
| 23 |
| 24 MediaQueryToken nextToken(MediaQueryInputStream&); |
| 25 static void tokenize(String, Vector<MediaQueryToken>&); |
| 26 |
| 27 private: |
| 28 class CodePoints; |
| 29 |
| 30 UChar consume(); |
| 31 void consume(unsigned); |
| 32 void reconsume(UChar); |
| 33 |
| 34 MediaQueryToken consumeNumericToken(); |
| 35 MediaQueryToken consumeIdentLikeToken(); |
| 36 MediaQueryToken consumeNumber(); |
| 37 |
| 38 void consumeUntilNonWhitespace(); |
| 39 |
| 40 bool consumeIfNext(UChar); |
| 41 String consumeName(); |
| 42 UChar consumeEscape(); |
| 43 |
| 44 bool nextTwoCharsAreValidEscape(); |
| 45 bool nextCharsAreNumber(); |
| 46 bool nextCharsAreIdentifier(); |
| 47 |
| 48 typedef MediaQueryToken (MediaQueryTokenizer::*CodePoint)(UChar); |
| 49 |
| 50 MediaQueryToken whiteSpace(UChar); |
| 51 MediaQueryToken leftParenthesis(UChar); |
| 52 MediaQueryToken rightParenthesis(UChar); |
| 53 MediaQueryToken plusOrFullStop(UChar); |
| 54 MediaQueryToken comma(UChar); |
| 55 MediaQueryToken hyphenMinus(UChar); |
| 56 MediaQueryToken solidus(UChar); |
| 57 MediaQueryToken colon(UChar); |
| 58 MediaQueryToken semiColon(UChar); |
| 59 MediaQueryToken reverseSolidus(UChar); |
| 60 MediaQueryToken asciiDigit(UChar); |
| 61 MediaQueryToken nameStart(UChar); |
| 62 MediaQueryToken endOfFile(UChar); |
| 63 |
| 64 CodePoints* codePoints(); |
| 65 |
| 66 MediaQueryInputStream* m_input; |
| 67 }; |
| 68 |
| 69 |
| 70 |
| 71 } // namespace WebCore |
| 72 |
| 73 #endif // MediaQueryTokenizer_h |
OLD | NEW |