OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of parser; | 5 part of parser; |
6 | 6 |
7 // TODO(terry): Need to be consistent with tokens either they're ASCII tokens | 7 // TODO(terry): Need to be consistent with tokens either they're ASCII tokens |
8 // e.g., ASTERISK or they're CSS e.g., PSEUDO, COMBINATOR_*. | 8 // e.g., ASTERISK or they're CSS e.g., PSEUDO, COMBINATOR_*. |
9 class TokenKind { | 9 class TokenKind { |
10 // Common shared tokens used in TokenizerBase. | 10 // Common shared tokens used in TokenizerBase. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 static const int UNIT_VIEWPORT_VW = 623; | 136 static const int UNIT_VIEWPORT_VW = 623; |
137 static const int UNIT_VIEWPORT_VH = 624; | 137 static const int UNIT_VIEWPORT_VH = 624; |
138 static const int UNIT_VIEWPORT_VMIN = 625; | 138 static const int UNIT_VIEWPORT_VMIN = 625; |
139 static const int UNIT_VIEWPORT_VMAX = 626; | 139 static const int UNIT_VIEWPORT_VMAX = 626; |
140 | 140 |
141 // Directives (@nnnn) | 141 // Directives (@nnnn) |
142 static const int DIRECTIVE_NONE = 650; | 142 static const int DIRECTIVE_NONE = 650; |
143 static const int DIRECTIVE_IMPORT = 651; | 143 static const int DIRECTIVE_IMPORT = 651; |
144 static const int DIRECTIVE_MEDIA = 652; | 144 static const int DIRECTIVE_MEDIA = 652; |
145 static const int DIRECTIVE_PAGE = 653; | 145 static const int DIRECTIVE_PAGE = 653; |
146 static const int DIRECTIVE_INCLUDE = 654; | |
147 static const int DIRECTIVE_STYLET = 655; | 146 static const int DIRECTIVE_STYLET = 655; |
148 static const int DIRECTIVE_KEYFRAMES = 656; | 147 static const int DIRECTIVE_KEYFRAMES = 656; |
149 static const int DIRECTIVE_FONTFACE = 657; | 148 static const int DIRECTIVE_FONTFACE = 657; |
150 static const int DIRECTIVE_NAMESPACE = 658; | 149 static const int DIRECTIVE_NAMESPACE = 658; |
151 | 150 |
152 // Media query operators | 151 // Media query operators |
153 static const int MEDIA_OP_ONLY = 665; // Unary. | 152 static const int MEDIA_OP_ONLY = 665; // Unary. |
154 static const int MEDIA_OP_NOT = 666; // Unary. | 153 static const int MEDIA_OP_NOT = 666; // Unary. |
155 static const int MEDIA_OP_AND = 667; // Binary. | 154 static const int MEDIA_OP_AND = 667; // Binary. |
156 | 155 |
(...skipping 21 matching lines...) Expand all Loading... |
178 static const int HASH_NAME = 702; // #elementId | 177 static const int HASH_NAME = 702; // #elementId |
179 static const int ATTRIBUTE_NAME = 703; // [attrib] | 178 static const int ATTRIBUTE_NAME = 703; // [attrib] |
180 static const int PSEUDO_ELEMENT_NAME = 704; // ::pseudoElement | 179 static const int PSEUDO_ELEMENT_NAME = 704; // ::pseudoElement |
181 static const int PSEUDO_CLASS_NAME = 705; // :pseudoClass | 180 static const int PSEUDO_CLASS_NAME = 705; // :pseudoClass |
182 static const int NEGATION = 706; // NOT | 181 static const int NEGATION = 706; // NOT |
183 | 182 |
184 static const List<Map<int, String>> _DIRECTIVES = const [ | 183 static const List<Map<int, String>> _DIRECTIVES = const [ |
185 const {'type': TokenKind.DIRECTIVE_IMPORT, 'value' : 'import'}, | 184 const {'type': TokenKind.DIRECTIVE_IMPORT, 'value' : 'import'}, |
186 const {'type': TokenKind.DIRECTIVE_MEDIA, 'value' : 'media'}, | 185 const {'type': TokenKind.DIRECTIVE_MEDIA, 'value' : 'media'}, |
187 const {'type': TokenKind.DIRECTIVE_PAGE, 'value' : 'page'}, | 186 const {'type': TokenKind.DIRECTIVE_PAGE, 'value' : 'page'}, |
188 const {'type': TokenKind.DIRECTIVE_INCLUDE, 'value' : 'include'}, | |
189 const {'type': TokenKind.DIRECTIVE_STYLET, 'value' : 'stylet'}, | 187 const {'type': TokenKind.DIRECTIVE_STYLET, 'value' : 'stylet'}, |
190 const {'type': TokenKind.DIRECTIVE_KEYFRAMES, 'value' : '-webkit-keyframes'}
, | 188 const {'type': TokenKind.DIRECTIVE_KEYFRAMES, 'value' : '-webkit-keyframes'}
, |
191 const {'type': TokenKind.DIRECTIVE_FONTFACE, 'value' : 'font-face'}, | 189 const {'type': TokenKind.DIRECTIVE_FONTFACE, 'value' : 'font-face'}, |
192 const {'type': TokenKind.DIRECTIVE_NAMESPACE, 'value' : 'namespace'}, | 190 const {'type': TokenKind.DIRECTIVE_NAMESPACE, 'value' : 'namespace'}, |
193 ]; | 191 ]; |
194 | 192 |
195 static const List<Map<int, String>> MEDIA_OPERATORS = const [ | 193 static const List<Map<int, String>> MEDIA_OPERATORS = const [ |
196 const {'type': TokenKind.MEDIA_OP_ONLY, 'value' : 'only'}, | 194 const {'type': TokenKind.MEDIA_OP_ONLY, 'value' : 'only'}, |
197 const {'type': TokenKind.MEDIA_OP_NOT, 'value' : 'not'}, | 195 const {'type': TokenKind.MEDIA_OP_NOT, 'value' : 'not'}, |
198 const {'type': TokenKind.MEDIA_OP_AND, 'value' : 'and'}, | 196 const {'type': TokenKind.MEDIA_OP_AND, 'value' : 'and'}, |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 throw "Unknown TOKEN"; | 668 throw "Unknown TOKEN"; |
671 } | 669 } |
672 } | 670 } |
673 | 671 |
674 static bool isKindIdentifier(int kind) { | 672 static bool isKindIdentifier(int kind) { |
675 switch(kind) { | 673 switch(kind) { |
676 // Synthesized tokens. | 674 // Synthesized tokens. |
677 case TokenKind.DIRECTIVE_IMPORT: | 675 case TokenKind.DIRECTIVE_IMPORT: |
678 case TokenKind.DIRECTIVE_MEDIA: | 676 case TokenKind.DIRECTIVE_MEDIA: |
679 case TokenKind.DIRECTIVE_PAGE: | 677 case TokenKind.DIRECTIVE_PAGE: |
680 case TokenKind.DIRECTIVE_INCLUDE: | |
681 case TokenKind.DIRECTIVE_STYLET: | 678 case TokenKind.DIRECTIVE_STYLET: |
682 case TokenKind.DIRECTIVE_KEYFRAMES: | 679 case TokenKind.DIRECTIVE_KEYFRAMES: |
683 case TokenKind.DIRECTIVE_FONTFACE: | 680 case TokenKind.DIRECTIVE_FONTFACE: |
684 case TokenKind.DIRECTIVE_NAMESPACE: | 681 case TokenKind.DIRECTIVE_NAMESPACE: |
685 case TokenKind.UNIT_EM: | 682 case TokenKind.UNIT_EM: |
686 case TokenKind.UNIT_EX: | 683 case TokenKind.UNIT_EX: |
687 case TokenKind.UNIT_LENGTH_PX: | 684 case TokenKind.UNIT_LENGTH_PX: |
688 case TokenKind.UNIT_LENGTH_CM: | 685 case TokenKind.UNIT_LENGTH_CM: |
689 case TokenKind.UNIT_LENGTH_MM: | 686 case TokenKind.UNIT_LENGTH_MM: |
690 case TokenKind.UNIT_LENGTH_IN: | 687 case TokenKind.UNIT_LENGTH_IN: |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 static const int SLASH = 0x2f; // "/".codeUnitAt(0) | 749 static const int SLASH = 0x2f; // "/".codeUnitAt(0) |
753 static const int EQUALS = 0x3d; // "=".codeUnitAt(0) | 750 static const int EQUALS = 0x3d; // "=".codeUnitAt(0) |
754 static const int OR = 0x7c; // "|".codeUnitAt(0) | 751 static const int OR = 0x7c; // "|".codeUnitAt(0) |
755 static const int CARET = 0x5e; // "^".codeUnitAt(0) | 752 static const int CARET = 0x5e; // "^".codeUnitAt(0) |
756 static const int DOLLAR = 0x24; // "\$".codeUnitAt(0) | 753 static const int DOLLAR = 0x24; // "\$".codeUnitAt(0) |
757 static const int LESS = 0x3c; // "<".codeUnitAt(0) | 754 static const int LESS = 0x3c; // "<".codeUnitAt(0) |
758 static const int BANG = 0x21; // "!".codeUnitAt(0) | 755 static const int BANG = 0x21; // "!".codeUnitAt(0) |
759 static const int MINUS = 0x2d; // "-".codeUnitAt(0) | 756 static const int MINUS = 0x2d; // "-".codeUnitAt(0) |
760 static const int BACKSLASH = 0x5c; // "\".codeUnitAt(0) | 757 static const int BACKSLASH = 0x5c; // "\".codeUnitAt(0) |
761 } | 758 } |
OLD | NEW |