Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Side by Side Diff: utils/css/tokenkind.dart

Issue 10919024: - Change "static final" to "static const" in the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/css/generate.dart ('k') | utils/pub/repo_source.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // TODO(terry): Need to be consistent with tokens either they're ASCII tokens 5 // TODO(terry): Need to be consistent with tokens either they're ASCII tokens
6 // e.g., ASTERISK or they're CSS e.g., PSEUDO, COMBINATOR_*. 6 // e.g., ASTERISK or they're CSS e.g., PSEUDO, COMBINATOR_*.
7 class TokenKind { 7 class TokenKind {
8 // Common shared tokens used in TokenizerBase. 8 // Common shared tokens used in TokenizerBase.
9 static final int UNUSED = 0; // Unused place holder... 9 static const int UNUSED = 0; // Unused place holder...
10 static final int END_OF_FILE = 1; // TODO(terry): Must match base 10 static const int END_OF_FILE = 1; // TODO(terry): Must match base
11 static final int LPAREN = 2; // ( 11 static const int LPAREN = 2; // (
12 static final int RPAREN = 3; // ) 12 static const int RPAREN = 3; // )
13 static final int LBRACK = 4; // [ 13 static const int LBRACK = 4; // [
14 static final int RBRACK = 5; // ] 14 static const int RBRACK = 5; // ]
15 static final int LBRACE = 6; // { 15 static const int LBRACE = 6; // {
16 static final int RBRACE = 7; // } 16 static const int RBRACE = 7; // }
17 static final int DOT = 8; // . 17 static const int DOT = 8; // .
18 static final int SEMICOLON = 9; // ; 18 static const int SEMICOLON = 9; // ;
19 19
20 // Unique tokens for CSS. 20 // Unique tokens for CSS.
21 static final int AT = 10; // @ 21 static const int AT = 10; // @
22 static final int HASH = 11; // # 22 static const int HASH = 11; // #
23 static final int PLUS = 12; // + 23 static const int PLUS = 12; // +
24 static final int GREATER = 13; // > 24 static const int GREATER = 13; // >
25 static final int TILDE = 14; // ~ 25 static const int TILDE = 14; // ~
26 static final int ASTERISK = 15; // * 26 static const int ASTERISK = 15; // *
27 static final int NAMESPACE = 16; // | 27 static const int NAMESPACE = 16; // |
28 static final int COLON = 17; // : 28 static const int COLON = 17; // :
29 static final int PRIVATE_NAME = 18; // _ prefix private class or id 29 static const int PRIVATE_NAME = 18; // _ prefix private class or id
30 static final int COMMA = 19; // , 30 static const int COMMA = 19; // ,
31 static final int SPACE = 20; 31 static const int SPACE = 20;
32 static final int TAB = 21; // /t 32 static const int TAB = 21; // /t
33 static final int NEWLINE = 22; // /n 33 static const int NEWLINE = 22; // /n
34 static final int RETURN = 23; // /r 34 static const int RETURN = 23; // /r
35 static final int PERCENT = 24; // % 35 static const int PERCENT = 24; // %
36 static final int SINGLE_QUOTE = 25; // ' 36 static const int SINGLE_QUOTE = 25; // '
37 static final int DOUBLE_QUOTE = 26; // " 37 static const int DOUBLE_QUOTE = 26; // "
38 static final int SLASH = 27; // / 38 static const int SLASH = 27; // /
39 static final int EQUALS = 28; // = 39 static const int EQUALS = 28; // =
40 static final int OR = 29; // | 40 static const int OR = 29; // |
41 static final int CARET = 30; // ^ 41 static const int CARET = 30; // ^
42 static final int DOLLAR = 31; // $ 42 static const int DOLLAR = 31; // $
43 static final int LESS = 32; // < 43 static const int LESS = 32; // <
44 static final int BANG = 33; // ! 44 static const int BANG = 33; // !
45 static final int MINUS = 34; // - 45 static const int MINUS = 34; // -
46 46
47 // WARNING: END_TOKENS must be 1 greater than the last token above (last 47 // WARNING: END_TOKENS must be 1 greater than the last token above (last
48 // character in our list). Also add to kindToString function and the 48 // character in our list). Also add to kindToString function and the
49 // constructor for TokenKind. 49 // constructor for TokenKind.
50 50
51 static final int END_TOKENS = 35; // Marker for last token in list 51 static const int END_TOKENS = 35; // Marker for last token in list
52 52
53 /** [TokenKind] representing integer tokens. */ 53 /** [TokenKind] representing integer tokens. */
54 static final int INTEGER = 60; // TODO(terry): must match base 54 static const int INTEGER = 60; // TODO(terry): must match base
55 55
56 /** [TokenKind] representing hex integer tokens. */ 56 /** [TokenKind] representing hex integer tokens. */
57 // static final int HEX_INTEGER = 61; // TODO(terry): must match bas e 57 // static const int HEX_INTEGER = 61; // TODO(terry): must match bas e
58 58
59 /** [TokenKind] representing double tokens. */ 59 /** [TokenKind] representing double tokens. */
60 static final int DOUBLE = 62; // TODO(terry): must match base 60 static const int DOUBLE = 62; // TODO(terry): must match base
61 61
62 /** [TokenKind] representing whitespace tokens. */ 62 /** [TokenKind] representing whitespace tokens. */
63 static final int WHITESPACE = 63; // TODO(terry): must match base 63 static const int WHITESPACE = 63; // TODO(terry): must match base
64 64
65 /** [TokenKind] representing comment tokens. */ 65 /** [TokenKind] representing comment tokens. */
66 static final int COMMENT = 64; // TODO(terry): must match base 66 static const int COMMENT = 64; // TODO(terry): must match base
67 67
68 /** [TokenKind] representing error tokens. */ 68 /** [TokenKind] representing error tokens. */
69 static final int ERROR = 65; // TODO(terry): must match base 69 static const int ERROR = 65; // TODO(terry): must match base
70 70
71 /** [TokenKind] representing incomplete string tokens. */ 71 /** [TokenKind] representing incomplete string tokens. */
72 static final int INCOMPLETE_STRING = 66; // TODO(terry): must match base 72 static const int INCOMPLETE_STRING = 66; // TODO(terry): must match base
73 73
74 /** [TokenKind] representing incomplete comment tokens. */ 74 /** [TokenKind] representing incomplete comment tokens. */
75 static final int INCOMPLETE_COMMENT = 67; // TODO(terry): must match base 75 static const int INCOMPLETE_COMMENT = 67; // TODO(terry): must match base
76 76
77 // Synthesized Tokens (no character associated with TOKEN). 77 // Synthesized Tokens (no character associated with TOKEN).
78 // TODO(terry): Possible common names used by both Dart and CSS tokenizers. 78 // TODO(terry): Possible common names used by both Dart and CSS tokenizers.
79 static final int STRING = 500; 79 static const int STRING = 500;
80 static final int STRING_PART = 501; 80 static const int STRING_PART = 501;
81 static final int NUMBER = 502; 81 static const int NUMBER = 502;
82 static final int HEX_NUMBER = 503; 82 static const int HEX_NUMBER = 503;
83 static final int HTML_COMMENT = 504; // <!-- 83 static const int HTML_COMMENT = 504; // <!--
84 static final int IMPORTANT = 505; // !important 84 static const int IMPORTANT = 505; // !important
85 static final int IDENTIFIER = 511; 85 static const int IDENTIFIER = 511;
86 86
87 // Uniquely synthesized tokens for CSS. 87 // Uniquely synthesized tokens for CSS.
88 static final int SELECTOR_EXPRESSION = 512; 88 static const int SELECTOR_EXPRESSION = 512;
89 static final int COMBINATOR_NONE = 513; 89 static const int COMBINATOR_NONE = 513;
90 static final int COMBINATOR_DESCENDANT = 514; // Space combinator 90 static const int COMBINATOR_DESCENDANT = 514; // Space combinator
91 static final int COMBINATOR_PLUS = 515; // + combinator 91 static const int COMBINATOR_PLUS = 515; // + combinator
92 static final int COMBINATOR_GREATER = 516; // > combinator 92 static const int COMBINATOR_GREATER = 516; // > combinator
93 static final int COMBINATOR_TILDE = 517; // ~ combinator 93 static const int COMBINATOR_TILDE = 517; // ~ combinator
94 94
95 static final int UNARY_OP_NONE = 518; // No unary operator present. 95 static const int UNARY_OP_NONE = 518; // No unary operator present.
96 96
97 // Attribute match types: 97 // Attribute match types:
98 static final int INCLUDES = 530; // '~=' 98 static const int INCLUDES = 530; // '~='
99 static final int DASH_MATCH = 531; // '|=' 99 static const int DASH_MATCH = 531; // '|='
100 static final int PREFIX_MATCH = 532; // '^=' 100 static const int PREFIX_MATCH = 532; // '^='
101 static final int SUFFIX_MATCH = 533; // '$=' 101 static const int SUFFIX_MATCH = 533; // '$='
102 static final int SUBSTRING_MATCH = 534; // '*=' 102 static const int SUBSTRING_MATCH = 534; // '*='
103 static final int NO_MATCH = 535; // No operator. 103 static const int NO_MATCH = 535; // No operator.
104 104
105 // Unit types: 105 // Unit types:
106 static final int UNIT_EM = 600; 106 static const int UNIT_EM = 600;
107 static final int UNIT_EX = 601; 107 static const int UNIT_EX = 601;
108 static final int UNIT_LENGTH_PX = 602; 108 static const int UNIT_LENGTH_PX = 602;
109 static final int UNIT_LENGTH_CM = 603; 109 static const int UNIT_LENGTH_CM = 603;
110 static final int UNIT_LENGTH_MM = 604; 110 static const int UNIT_LENGTH_MM = 604;
111 static final int UNIT_LENGTH_IN = 605; 111 static const int UNIT_LENGTH_IN = 605;
112 static final int UNIT_LENGTH_PT = 606; 112 static const int UNIT_LENGTH_PT = 606;
113 static final int UNIT_LENGTH_PC = 607; 113 static const int UNIT_LENGTH_PC = 607;
114 static final int UNIT_ANGLE_DEG = 608; 114 static const int UNIT_ANGLE_DEG = 608;
115 static final int UNIT_ANGLE_RAD = 609; 115 static const int UNIT_ANGLE_RAD = 609;
116 static final int UNIT_ANGLE_GRAD = 610; 116 static const int UNIT_ANGLE_GRAD = 610;
117 static final int UNIT_TIME_MS = 611; 117 static const int UNIT_TIME_MS = 611;
118 static final int UNIT_TIME_S = 612; 118 static const int UNIT_TIME_S = 612;
119 static final int UNIT_FREQ_HZ = 613; 119 static const int UNIT_FREQ_HZ = 613;
120 static final int UNIT_FREQ_KHZ = 614; 120 static const int UNIT_FREQ_KHZ = 614;
121 static final int UNIT_PERCENT = 615; 121 static const int UNIT_PERCENT = 615;
122 static final int UNIT_FRACTION = 616; 122 static const int UNIT_FRACTION = 616;
123 123
124 // Directives (@nnnn) 124 // Directives (@nnnn)
125 static final int DIRECTIVE_NONE = 650; 125 static const int DIRECTIVE_NONE = 650;
126 static final int DIRECTIVE_IMPORT = 651; 126 static const int DIRECTIVE_IMPORT = 651;
127 static final int DIRECTIVE_MEDIA = 652; 127 static const int DIRECTIVE_MEDIA = 652;
128 static final int DIRECTIVE_PAGE = 653; 128 static const int DIRECTIVE_PAGE = 653;
129 static final int DIRECTIVE_INCLUDE = 654; 129 static const int DIRECTIVE_INCLUDE = 654;
130 static final int DIRECTIVE_STYLET = 655; 130 static const int DIRECTIVE_STYLET = 655;
131 static final int DIRECTIVE_KEYFRAMES = 656; 131 static const int DIRECTIVE_KEYFRAMES = 656;
132 static final int DIRECTIVE_FONTFACE = 657; 132 static const int DIRECTIVE_FONTFACE = 657;
133 133
134 // Simple selector type. 134 // Simple selector type.
135 static final int CLASS_NAME = 700; // .class 135 static const int CLASS_NAME = 700; // .class
136 static final int ELEMENT_NAME = 701; // tagName 136 static const int ELEMENT_NAME = 701; // tagName
137 static final int HASH_NAME = 702; // #elementId 137 static const int HASH_NAME = 702; // #elementId
138 static final int ATTRIBUTE_NAME = 703; // [attrib] 138 static const int ATTRIBUTE_NAME = 703; // [attrib]
139 static final int PSEUDO_ELEMENT_NAME = 704; // ::pseudoElement 139 static const int PSEUDO_ELEMENT_NAME = 704; // ::pseudoElement
140 static final int PSEUDO_CLASS_NAME = 705; // :pseudoClass 140 static const int PSEUDO_CLASS_NAME = 705; // :pseudoClass
141 static final int NEGATION = 706; // NOT 141 static const int NEGATION = 706; // NOT
142 142
143 static final List<Map<int, String>> _DIRECTIVES = const [ 143 static const List<Map<int, String>> _DIRECTIVES = const [
144 const {'type': TokenKind.DIRECTIVE_IMPORT, 'value' : 'import'}, 144 const {'type': TokenKind.DIRECTIVE_IMPORT, 'value' : 'import'},
145 const {'type': TokenKind.DIRECTIVE_MEDIA, 'value' : 'media'}, 145 const {'type': TokenKind.DIRECTIVE_MEDIA, 'value' : 'media'},
146 const {'type': TokenKind.DIRECTIVE_PAGE, 'value' : 'page'}, 146 const {'type': TokenKind.DIRECTIVE_PAGE, 'value' : 'page'},
147 const {'type': TokenKind.DIRECTIVE_INCLUDE, 'value' : 'include'}, 147 const {'type': TokenKind.DIRECTIVE_INCLUDE, 'value' : 'include'},
148 const {'type': TokenKind.DIRECTIVE_STYLET, 'value' : 'stylet'}, 148 const {'type': TokenKind.DIRECTIVE_STYLET, 'value' : 'stylet'},
149 const {'type': TokenKind.DIRECTIVE_KEYFRAMES, 'value' : '-webkit-keyframes'} , 149 const {'type': TokenKind.DIRECTIVE_KEYFRAMES, 'value' : '-webkit-keyframes'} ,
150 const {'type': TokenKind.DIRECTIVE_FONTFACE, 'value' : 'font-face'}, 150 const {'type': TokenKind.DIRECTIVE_FONTFACE, 'value' : 'font-face'},
151 ]; 151 ];
152 152
153 static final List<Map<int, String>> _UNITS = const [ 153 static const List<Map<int, String>> _UNITS = const [
154 const {'unit': TokenKind.UNIT_EM, 'value' : 'em'}, 154 const {'unit': TokenKind.UNIT_EM, 'value' : 'em'},
155 const {'unit': TokenKind.UNIT_EX, 'value' : 'ex'}, 155 const {'unit': TokenKind.UNIT_EX, 'value' : 'ex'},
156 const {'unit': TokenKind.UNIT_LENGTH_PX, 'value' : 'px'}, 156 const {'unit': TokenKind.UNIT_LENGTH_PX, 'value' : 'px'},
157 const {'unit': TokenKind.UNIT_LENGTH_CM, 'value' : 'cm'}, 157 const {'unit': TokenKind.UNIT_LENGTH_CM, 'value' : 'cm'},
158 const {'unit': TokenKind.UNIT_LENGTH_MM, 'value' : 'mm'}, 158 const {'unit': TokenKind.UNIT_LENGTH_MM, 'value' : 'mm'},
159 const {'unit': TokenKind.UNIT_LENGTH_IN, 'value' : 'in'}, 159 const {'unit': TokenKind.UNIT_LENGTH_IN, 'value' : 'in'},
160 const {'unit': TokenKind.UNIT_LENGTH_PT, 'value' : 'pt'}, 160 const {'unit': TokenKind.UNIT_LENGTH_PT, 'value' : 'pt'},
161 const {'unit': TokenKind.UNIT_LENGTH_PC, 'value' : 'pc'}, 161 const {'unit': TokenKind.UNIT_LENGTH_PC, 'value' : 'pc'},
162 const {'unit': TokenKind.UNIT_ANGLE_DEG, 'value' : 'deg'}, 162 const {'unit': TokenKind.UNIT_ANGLE_DEG, 'value' : 'deg'},
163 const {'unit': TokenKind.UNIT_ANGLE_RAD, 'value' : 'rad'}, 163 const {'unit': TokenKind.UNIT_ANGLE_RAD, 'value' : 'rad'},
164 const {'unit': TokenKind.UNIT_ANGLE_GRAD, 'value' : 'grad'}, 164 const {'unit': TokenKind.UNIT_ANGLE_GRAD, 'value' : 'grad'},
165 const {'unit': TokenKind.UNIT_TIME_MS, 'value' : 'ms'}, 165 const {'unit': TokenKind.UNIT_TIME_MS, 'value' : 'ms'},
166 const {'unit': TokenKind.UNIT_TIME_S, 'value' : 's'}, 166 const {'unit': TokenKind.UNIT_TIME_S, 'value' : 's'},
167 const {'unit': TokenKind.UNIT_FREQ_HZ, 'value' : 'hz'}, 167 const {'unit': TokenKind.UNIT_FREQ_HZ, 'value' : 'hz'},
168 const {'unit': TokenKind.UNIT_FREQ_KHZ, 'value' : 'khz'}, 168 const {'unit': TokenKind.UNIT_FREQ_KHZ, 'value' : 'khz'},
169 const {'unit': TokenKind.UNIT_FRACTION, 'value' : 'fr'}, 169 const {'unit': TokenKind.UNIT_FRACTION, 'value' : 'fr'},
170 ]; 170 ];
171 171
172 // Some more constants: 172 // Some more constants:
173 static final int ASCII_UPPER_A = 65; // ASCII value for uppercase A 173 static const int ASCII_UPPER_A = 65; // ASCII value for uppercase A
174 static final int ASCII_UPPER_Z = 90; // ASCII value for uppercase Z 174 static const int ASCII_UPPER_Z = 90; // ASCII value for uppercase Z
175 175
176 // Extended color keywords: 176 // Extended color keywords:
177 static final List<Map<String, int>> _EXTENDED_COLOR_NAMES = const [ 177 static const List<Map<String, int>> _EXTENDED_COLOR_NAMES = const [
178 const {'name' : 'aliceblue', 'value' : 0xF08FF}, 178 const {'name' : 'aliceblue', 'value' : 0xF08FF},
179 const {'name' : 'antiquewhite', 'value' : 0xFAEBD7}, 179 const {'name' : 'antiquewhite', 'value' : 0xFAEBD7},
180 const {'name' : 'aqua', 'value' : 0x00FFFF}, 180 const {'name' : 'aqua', 'value' : 0x00FFFF},
181 const {'name' : 'aquamarine', 'value' : 0x7FFFD4}, 181 const {'name' : 'aquamarine', 'value' : 0x7FFFD4},
182 const {'name' : 'azure', 'value' : 0xF0FFFF}, 182 const {'name' : 'azure', 'value' : 0xF0FFFF},
183 const {'name' : 'beige', 'value' : 0xF5F5DC}, 183 const {'name' : 'beige', 'value' : 0xF5F5DC},
184 const {'name' : 'bisque', 'value' : 0xFFE4C4}, 184 const {'name' : 'bisque', 'value' : 0xFFE4C4},
185 const {'name' : 'black', 'value' : 0x000000}, 185 const {'name' : 'black', 'value' : 0x000000},
186 const {'name' : 'blanchedalmond', 'value' : 0xFFEBCD}, 186 const {'name' : 'blanchedalmond', 'value' : 0xFFEBCD},
187 const {'name' : 'blue', 'value' : 0x0000FF}, 187 const {'name' : 'blue', 'value' : 0x0000FF},
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 ]; 325 ];
326 326
327 // TODO(terry): Should used Dart mirroring for parameter values and types 327 // TODO(terry): Should used Dart mirroring for parameter values and types
328 // especially for enumeration (e.g., counter's second parameter 328 // especially for enumeration (e.g., counter's second parameter
329 // is list-style-type which is an enumerated list for ordering 329 // is list-style-type which is an enumerated list for ordering
330 // of a list 'circle', 'decimal', 'lower-roman', 'square', etc. 330 // of a list 'circle', 'decimal', 'lower-roman', 'square', etc.
331 // see http://www.w3schools.com/cssref/pr_list-style-type.asp 331 // see http://www.w3schools.com/cssref/pr_list-style-type.asp
332 // for list of possible values. 332 // for list of possible values.
333 333
334 // List of valid CSS functions: 334 // List of valid CSS functions:
335 static final List<Map<String, Object>> _FUNCTIONS = const [ 335 static const List<Map<String, Object>> _FUNCTIONS = const [
336 const {'name' : 'counter', 'info' : const {'params' : 2, 'expr' : false}}, 336 const {'name' : 'counter', 'info' : const {'params' : 2, 'expr' : false}},
337 const {'name' : 'attr', 'info' : const {'params' : 1, 'expr' : false}}, 337 const {'name' : 'attr', 'info' : const {'params' : 1, 'expr' : false}},
338 const {'name' : 'calc', 'info' : const {'params' : 1, 'expr' : true}}, 338 const {'name' : 'calc', 'info' : const {'params' : 1, 'expr' : true}},
339 const {'name' : 'min', 'info' : const {'params' : 2, 'expr' : true}}, 339 const {'name' : 'min', 'info' : const {'params' : 2, 'expr' : true}},
340 const {'name' : 'max', 'info' : const {'params' : 2, 'expr' : true}}, 340 const {'name' : 'max', 'info' : const {'params' : 2, 'expr' : true}},
341 341
342 // 2D functions: 342 // 2D functions:
343 const {'name' : 'translateX', 343 const {'name' : 'translateX',
344 'info' : const {'params' : 1, 'expr' : false}}, 344 'info' : const {'params' : 1, 'expr' : false}},
345 const {'name' : 'translateY', 345 const {'name' : 'translateY',
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 } 587 }
588 588
589 } 589 }
590 590
591 class NoColorMatchException implements Exception { 591 class NoColorMatchException implements Exception {
592 String _colorName; 592 String _colorName;
593 NoColorMatchException(this._colorName); 593 NoColorMatchException(this._colorName);
594 594
595 String get name() => _colorName; 595 String get name() => _colorName;
596 } 596 }
OLDNEW
« no previous file with comments | « utils/css/generate.dart ('k') | utils/pub/repo_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698