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

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

Issue 137013002: Removed obsolete code (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed libraries not used Created 6 years, 11 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/template/tokenizer_base.dart ('k') | utils/template/tool.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
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_*.
7 class TokenKind {
8 // Common shared tokens used in TokenizerBase.
9 static const int UNUSED = 0; // Unused place holder...
10 static const int END_OF_FILE = 1;
11 static const int LPAREN = 2; // (
12 static const int RPAREN = 3; // )
13 static const int LBRACK = 4; // [
14 static const int RBRACK = 5; // ]
15 static const int LBRACE = 6; // {
16 static const int RBRACE = 7; // }
17 static const int DOT = 8; // .
18 static const int SEMICOLON = 9; // ;
19 static const int SPACE = 10; // space character
20 static const int TAB = 11; // \t
21 static const int NEWLINE = 12; // \n
22 static const int RETURN = 13; // \r
23 static const int COMMA = 14; // ,
24
25 // Unique tokens.
26 static const int LESS_THAN = 15; // <
27 static const int GREATER_THAN = 16; // >
28 static const int SLASH = 17; // /
29 static const int DOLLAR = 18; // $
30 static const int HASH = 19; // #
31 static const int MINUS = 20; // -
32 static const int EQUAL = 21; // =
33 static const int DOUBLE_QUOTE = 22; // "
34 static const int SINGLE_QUOTE = 23; // '
35 static const int ASTERISK = 24; // *
36
37 // WARNING: END_TOKENS must be 1 greater than the last token above (last
38 // character in our list). Also add to kindToString function and the
39 // constructor for TokenKind.
40
41 static const int END_TOKENS = 25; // Marker for last token in list
42
43 // Synthesized tokens:
44
45 static const int END_NO_SCOPE_TAG = 50; // />
46 static const int START_EXPRESSION = 51; // ${
47 static const int START_COMMAND = 52; // ${#
48 static const int END_COMMAND = 53; // ${/
49 static const int EACH_COMMAND = 53; // ${#each list}
50 static const int WITH_COMMAND = 54; // ${#with object}
51 static const int IF_COMMAND = 55; // ${#if (expression)}
52 static const int ELSE_COMMAND = 56; // ${#else}
53
54 /** [TokenKind] representing integer tokens. */
55 static const int INTEGER = 60; // TODO(terry): must match base
56
57 /** [TokenKind] representing hex integer tokens. */
58 // static const int HEX_INTEGER = 61; // TODO(terry): must match base
59
60 /** [TokenKind] representing double tokens. */
61 static const int DOUBLE = 62; // TODO(terry): must match base
62
63 /** [TokenKind] representing whitespace tokens. */
64 static const int WHITESPACE = 63; // TODO(terry): must match base
65
66 /** [TokenKind] representing comment tokens. */
67 static const int COMMENT = 64; // TODO(terry): must match base
68
69 /** [TokenKind] representing error tokens. */
70 static const int ERROR = 65; // TODO(terry): must match base
71
72 /** [TokenKind] representing incomplete string tokens. */
73 static const int INCOMPLETE_STRING = 66; // TODO(terry): must match base
74
75 /** [TokenKind] representing incomplete comment tokens. */
76 static const int INCOMPLETE_COMMENT = 67; // TODO(terry): must match base
77
78 // Synthesized Tokens (no character associated with TOKEN).
79 // TODO(terry): Possible common names used by both Dart and CSS tokenizers.
80 static const int ATTR_VALUE = 500;
81 static const int NUMBER = 502;
82 static const int HEX_NUMBER = 503;
83 static const int HTML_COMMENT = 504; // <!--
84 static const int IDENTIFIER = 511;
85 static const int STRING = 512;
86 static const int STRING_PART = 513;
87
88 static const int TEMPLATE_KEYWORD = 595; // template keyword
89
90 // Elements
91 /* START_HTML_ELEMENT is first valid element tag name
92 * END_HTML_ELEMENT is the last valid element tag name
93 *
94 */
95 static const int START_HTML_ELEMENT = 600; // First valid tag name.
96 static const int A_ELEMENT = 600;
97 static const int ABBR_ELEMENT = 601;
98 static const int ACRONYM_ELEMENT = 602;
99 static const int ADDRESS_ELEMENT = 603;
100 static const int APPLET_ELEMENT = 604;
101 static const int AREA_ELEMENT = 605;
102 static const int B_ELEMENT = 606;
103 static const int BASE_ELEMENT = 607;
104 static const int BASEFONT_ELEMENT = 608;
105 static const int BDO_ELEMENT = 609;
106 static const int BIG_ELEMENT = 610;
107 static const int BLOCKQUOTE_ELEMENT = 611;
108 static const int BODY_ELEMENT = 612;
109 static const int BR_ELEMENT = 613;
110 static const int BUTTON_ELEMENT = 614;
111 static const int CAPTION_ELEMENT = 615;
112 static const int CENTER_ELEMENT = 616;
113 static const int CITE_ELEMENT = 617;
114 static const int CODE_ELEMENT = 618;
115 static const int COL_ELEMENT = 619;
116 static const int COLGROUP_ELEMENT = 620;
117 static const int DD_ELEMENT = 621;
118 static const int DEL_ELEMENT = 622;
119 static const int DFN_ELEMENT = 623;
120 static const int DIR_ELEMENT = 624;
121 static const int DIV_ELEMENT = 625;
122 static const int DL_ELEMENT = 626;
123 static const int DT_ELEMENT = 627;
124 static const int EM_ELEMENT = 628;
125 static const int FIELDSET_ELEMENT = 629;
126 static const int FONT_ELEMENT = 630;
127 static const int FORM_ELEMENT = 631;
128 static const int FRAME_ELEMENT = 632;
129 static const int FRAMESET_ELEMENT = 633;
130 static const int H1_ELEMENT = 634;
131 static const int H2_ELEMENT = 635;
132 static const int H3_ELEMENT = 636;
133 static const int H4_ELEMENT = 637;
134 static const int H5_ELEMENT = 638;
135 static const int H6_ELEMENT = 639;
136 static const int HEAD_ELEMENT = 640;
137 static const int HR_ELEMENT = 641;
138 static const int HTML_ELEMENT = 642;
139 static const int I_ELEMENT = 643;
140 static const int IFRAME_ELEMENT = 644;
141 static const int IMG_ELEMENT = 645;
142 static const int INPUT_ELEMENT = 646;
143 static const int INS_ELEMENT = 647;
144 static const int ISINDEX_ELEMENT = 648;
145 static const int KBD_ELEMENT = 649;
146 static const int LABEL_ELEMENT = 650;
147 static const int LEGEND_ELEMENT = 651;
148 static const int LI_ELEMENT = 652;
149 static const int LINK_ELEMENT = 653;
150 static const int MAP_ELEMENT = 654;
151 static const int MENU_ELEMENT = 645;
152 static const int META_ELEMENT = 656;
153 static const int NOFRAMES_ELEMENT = 657;
154 static const int NOSCRIPT_ELEMENT = 658;
155 static const int OBJECT_ELEMENT = 659;
156 static const int OL_ELEMENT = 660;
157 static const int OPTGROUP_ELEMENT = 661;
158 static const int OPTION_ELEMENT = 662;
159 static const int P_ELEMENT = 663;
160 static const int PARAM_ELEMENT = 664;
161 static const int PRE_ELEMENT = 665;
162 static const int Q_ELEMENT = 666;
163 static const int S_ELEMENT = 667;
164 static const int SAMP_ELEMENT = 668;
165 static const int SCRIPT_ELEMENT = 669;
166 static const int SELECT_ELEMENT = 670;
167 static const int SMALL_ELEMENT = 671;
168 static const int SPAN_ELEMENT = 672;
169 static const int STRIKE_ELEMENT = 673;
170 static const int STRONG_ELEMENT = 674;
171 static const int STYLE_ELEMENT = 675;
172 static const int SUB_ELEMENT = 676;
173 static const int SUP_ELEMENT = 677;
174 static const int TABLE_ELEMENT = 678;
175 static const int TBODY_ELEMENT = 679;
176 static const int TD_ELEMENT = 680;
177 static const int TEXTAREA_ELEMENT = 681;
178 static const int TFOOT_ELEMENT = 682;
179 static const int TH_ELEMENT = 683;
180 static const int THEAD_ELEMENT = 684;
181 static const int TITLE_ELEMENT = 685;
182 static const int TR_ELEMENT = 686;
183 static const int TT_ELEMENT = 687;
184 static const int U_ELEMENT = 688;
185 static const int UL_ELEMENT = 689;
186 static const int VAR_ELEMENT = 690;
187 static const int END_HTML_ELEMENT = VAR_ELEMENT; // Last valid tag name.
188
189 static bool validTagName(int tokId) {
190 return tokId >= TokenKind.START_HTML_ELEMENT &&
191 tokId <= TokenKind.END_HTML_ELEMENT;
192 }
193
194 static const List<Map<int, String>> _KEYWORDS = const [
195 const {'type': TokenKind.TEMPLATE_KEYWORD, 'value' : 'template'},
196 ];
197
198 static const List<int> _NON_SCOPED_ELEMENTS = const [
199 BR_ELEMENT,
200 ];
201
202 // tag values starting with a minus sign implies tag can be unscoped e.g.,
203 // <br> is valid without <br></br> or <br/>
204 static const List<Map<int, String>> _ELEMENTS = const [
205 const {'type': TokenKind.A_ELEMENT, 'value' : 'a'},
206 const {'type': TokenKind.ABBR_ELEMENT, 'value' : 'abbr'},
207 const {'type': TokenKind.ACRONYM_ELEMENT, 'value' : 'acronym'},
208 const {'type': TokenKind.ADDRESS_ELEMENT, 'value' : 'address'},
209 const {'type': TokenKind.APPLET_ELEMENT, 'value' : 'applet'},
210 const {'type': TokenKind.AREA_ELEMENT, 'value' : 'area'},
211 const {'type': TokenKind.B_ELEMENT, 'value' : 'b'},
212 const {'type': TokenKind.BASE_ELEMENT, 'value' : 'base'},
213 const {'type': TokenKind.BASEFONT_ELEMENT, 'value' : 'basefont'},
214 const {'type': TokenKind.BDO_ELEMENT, 'value' : 'bdo'},
215 const {'type': TokenKind.BIG_ELEMENT, 'value' : 'big'},
216 const {'type': TokenKind.BLOCKQUOTE_ELEMENT, 'value' : 'blockquote'},
217 const {'type': TokenKind.BODY_ELEMENT, 'value' : 'body'},
218 const {'type': TokenKind.BR_ELEMENT, 'value' : 'br'},
219 const {'type': TokenKind.BUTTON_ELEMENT, 'value' : 'button'},
220 const {'type': TokenKind.CAPTION_ELEMENT, 'value' : 'caption'},
221 const {'type': TokenKind.CENTER_ELEMENT, 'value' : 'center'},
222 const {'type': TokenKind.CITE_ELEMENT, 'value' : 'cite'},
223 const {'type': TokenKind.CODE_ELEMENT, 'value' : 'code'},
224 const {'type': TokenKind.COL_ELEMENT, 'value' : 'col'},
225 const {'type': TokenKind.COLGROUP_ELEMENT, 'value' : 'colgroup'},
226 const {'type': TokenKind.DD_ELEMENT, 'value' : 'dd'},
227 const {'type': TokenKind.DEL_ELEMENT, 'value' : 'del'},
228 const {'type': TokenKind.DFN_ELEMENT, 'value' : 'dfn'},
229 const {'type': TokenKind.DIR_ELEMENT, 'value' : 'dir'},
230 const {'type': TokenKind.DIV_ELEMENT, 'value' : 'div'},
231 const {'type': TokenKind.DL_ELEMENT, 'value' : 'dl'},
232 const {'type': TokenKind.DT_ELEMENT, 'value' : 'dt'},
233 const {'type': TokenKind.EM_ELEMENT, 'value' : 'em'},
234 const {'type': TokenKind.FIELDSET_ELEMENT, 'value' : 'fieldset'},
235 const {'type': TokenKind.FONT_ELEMENT, 'value' : 'font'},
236 const {'type': TokenKind.FORM_ELEMENT, 'value' : 'form'},
237 const {'type': TokenKind.FRAME_ELEMENT, 'value' : 'frame'},
238 const {'type': TokenKind.FRAMESET_ELEMENT, 'value' : 'frameset'},
239 const {'type': TokenKind.H1_ELEMENT, 'value' : 'h1'},
240 const {'type': TokenKind.H2_ELEMENT, 'value' : 'h2'},
241 const {'type': TokenKind.H3_ELEMENT, 'value' : 'h3'},
242 const {'type': TokenKind.H4_ELEMENT, 'value' : 'h4'},
243 const {'type': TokenKind.H5_ELEMENT, 'value' : 'h5'},
244 const {'type': TokenKind.H6_ELEMENT, 'value' : 'h6'},
245 const {'type': TokenKind.HEAD_ELEMENT, 'value' : 'head'},
246 const {'type': TokenKind.HR_ELEMENT, 'value' : 'hr'},
247 const {'type': TokenKind.HTML_ELEMENT, 'value' : 'html'},
248 const {'type': TokenKind.I_ELEMENT, 'value' : 'i'},
249 const {'type': TokenKind.IFRAME_ELEMENT, 'value' : 'iframe'},
250 const {'type': TokenKind.IMG_ELEMENT, 'value' : 'img'},
251 const {'type': TokenKind.INPUT_ELEMENT, 'value' : 'input'},
252 const {'type': TokenKind.INS_ELEMENT, 'value' : 'ins'},
253 const {'type': TokenKind.ISINDEX_ELEMENT, 'value' : 'isindex'},
254 const {'type': TokenKind.KBD_ELEMENT, 'value' : 'kbd'},
255 const {'type': TokenKind.LABEL_ELEMENT, 'value' : 'label'},
256 const {'type': TokenKind.LEGEND_ELEMENT, 'value' : 'legend'},
257 const {'type': TokenKind.LI_ELEMENT, 'value' : 'li'},
258 const {'type': TokenKind.LINK_ELEMENT, 'value' : 'link'},
259 const {'type': TokenKind.MAP_ELEMENT, 'value' : 'map'},
260 const {'type': TokenKind.MENU_ELEMENT, 'value' : 'menu'},
261 const {'type': TokenKind.META_ELEMENT, 'value' : 'meta'},
262 const {'type': TokenKind.NOFRAMES_ELEMENT, 'value' : 'noframes'},
263 const {'type': TokenKind.NOSCRIPT_ELEMENT, 'value' : 'noscript'},
264 const {'type': TokenKind.OBJECT_ELEMENT, 'value' : 'object'},
265 const {'type': TokenKind.OL_ELEMENT, 'value' : 'ol'},
266 const {'type': TokenKind.OPTGROUP_ELEMENT, 'value' : 'optgroup'},
267 const {'type': TokenKind.OPTION_ELEMENT, 'value' : 'option'},
268 const {'type': TokenKind.P_ELEMENT, 'value' : 'p'},
269 const {'type': TokenKind.PARAM_ELEMENT, 'value' : 'param'},
270 const {'type': TokenKind.PRE_ELEMENT, 'value' : 'pre'},
271 const {'type': TokenKind.Q_ELEMENT, 'value' : 'q'},
272 const {'type': TokenKind.S_ELEMENT, 'value' : 's'},
273 const {'type': TokenKind.SAMP_ELEMENT, 'value' : 'samp'},
274 const {'type': TokenKind.SCRIPT_ELEMENT, 'value' : 'script'},
275 const {'type': TokenKind.SELECT_ELEMENT, 'value' : 'select'},
276 const {'type': TokenKind.SMALL_ELEMENT, 'value' : 'small'},
277 const {'type': TokenKind.SPAN_ELEMENT, 'value' : 'span'},
278 const {'type': TokenKind.STRIKE_ELEMENT, 'value' : 'strike'},
279 const {'type': TokenKind.STRONG_ELEMENT, 'value' : 'strong'},
280 const {'type': TokenKind.STYLE_ELEMENT, 'value' : 'style'},
281 const {'type': TokenKind.SUB_ELEMENT, 'value' : 'sub'},
282 const {'type': TokenKind.SUP_ELEMENT, 'value' : 'sup'},
283 const {'type': TokenKind.TABLE_ELEMENT, 'value' : 'table'},
284 const {'type': TokenKind.TBODY_ELEMENT, 'value' : 'tbody'},
285 const {'type': TokenKind.TD_ELEMENT, 'value' : 'td'},
286 const {'type': TokenKind.TEXTAREA_ELEMENT, 'value' : 'textarea'},
287 const {'type': TokenKind.TFOOT_ELEMENT, 'value' : 'tfoot'},
288 const {'type': TokenKind.TH_ELEMENT, 'value' : 'th'},
289 const {'type': TokenKind.THEAD_ELEMENT, 'value' : 'thead'},
290 const {'type': TokenKind.TITLE_ELEMENT, 'value' : 'title'},
291 const {'type': TokenKind.TR_ELEMENT, 'value' : 'tr'},
292 const {'type': TokenKind.TT_ELEMENT, 'value' : 'tt'},
293 const {'type': TokenKind.U_ELEMENT, 'value' : 'u'},
294 const {'type': TokenKind.UL_ELEMENT, 'value' : 'ul'},
295 const {'type': TokenKind.VAR_ELEMENT, 'value' : 'var'},
296 ];
297
298 // Some more constants:
299 static const int ASCII_UPPER_A = 65; // ASCII value for uppercase A
300 static const int ASCII_UPPER_Z = 90; // ASCII value for uppercase Z
301
302 List<int> tokens;
303
304 /*
305 * Return the token that matches the unit ident found.
306 */
307 static int matchList(var identList, String tokenField, String text,
308 int offset, int length) {
309 for (final entry in identList) {
310 String ident = entry['value'];
311 if (length == ident.length) {
312 int idx = offset;
313 bool match = true;
314 for (int identIdx = 0; identIdx < ident.length; identIdx++) {
315 int identChar = ident.codeUnitAt(identIdx);
316 int char = text.codeUnitAt(idx++);
317 // Compare lowercase to lowercase then check if char is uppercase.
318 match = match && (char == identChar ||
319 ((char >= ASCII_UPPER_A && char <= ASCII_UPPER_Z) &&
320 (char + 32) == identChar));
321 if (!match) {
322 break;
323 }
324 }
325
326 if (match) {
327 // Completely matched; return the token for this unit.
328 return entry[tokenField];
329 }
330 }
331 }
332
333 return -1; // Not a unit token.
334 }
335
336 /*
337 * Return the token that matches the element ident found.
338 */
339 static int matchElements(String text, int offset, int length) {
340 return matchList(_ELEMENTS, 'type', text, offset, length);
341 }
342
343 static String tagNameFromTokenId(int tagTokenId) {
344 if (TokenKind.validTagName(tagTokenId)) {
345 for (final tag in TokenKind._ELEMENTS) {
346 if (tag['type'] == tagTokenId) {
347 return tag['value'];
348 }
349 }
350 }
351 }
352
353 static bool unscopedTag(int tagTokenId) {
354 for (final tagId in TokenKind._NON_SCOPED_ELEMENTS) {
355 if (tagId == tagTokenId) {
356 return true;
357 }
358 }
359
360 return false;
361 }
362
363 static int matchKeywords(String text, int offset, int length) {
364 return matchList(_KEYWORDS, 'type', text, offset, length);
365 }
366
367 static String kindToString(int kind) {
368 switch(kind) {
369 case TokenKind.UNUSED: return "ERROR";
370 case TokenKind.END_OF_FILE: return "end of file";
371 case TokenKind.LPAREN: return "(";
372 case TokenKind.RPAREN: return ")";
373 case TokenKind.LBRACK: return "[";
374 case TokenKind.RBRACK: return "]";
375 case TokenKind.LBRACE: return "{";
376 case TokenKind.RBRACE: return "}";
377 case TokenKind.DOT: return ".";
378 case TokenKind.SEMICOLON: return ";";
379 case TokenKind.SPACE: return " ";
380 case TokenKind.TAB: return "\t";
381 case TokenKind.NEWLINE: return "\n";
382 case TokenKind.RETURN: return "\r";
383 case TokenKind.COMMA: return ",";
384 case TokenKind.LESS_THAN: return "<";
385 case TokenKind.GREATER_THAN: return ">";
386 case TokenKind.SLASH: return "/";
387 case TokenKind.DOLLAR: return "\$";
388 case TokenKind.HASH: return "#";
389 case TokenKind.MINUS: return '-';
390 case TokenKind.EQUAL: return '=';
391 case TokenKind.DOUBLE_QUOTE: return '"';
392 case TokenKind.SINGLE_QUOTE: return "'";
393 case TokenKind.ASTERISK: return "*";
394 case TokenKind.END_NO_SCOPE_TAG: return '/>';
395 case TokenKind.START_EXPRESSION: return '\${';
396 case TokenKind.START_COMMAND: return '\${#';
397 case TokenKind.END_COMMAND: return '\${/';
398 case TokenKind.EACH_COMMAND: return '\${#each list}';
399 case TokenKind.WITH_COMMAND: return '\${with object}';
400 case TokenKind.IF_COMMAND: return '\${#if (expression)}';
401 case TokenKind.ELSE_COMMAND: return '\${#end}';
402 case TokenKind.INTEGER: return 'integer';
403 case TokenKind.DOUBLE: return 'double';
404 case TokenKind.WHITESPACE: return 'whitespace';
405 case TokenKind.COMMENT: return 'comment';
406 case TokenKind.ERROR: return 'error';
407 case TokenKind.INCOMPLETE_STRING : return 'incomplete string';
408 case TokenKind.INCOMPLETE_COMMENT: return 'incomplete comment';
409 case TokenKind.ATTR_VALUE: return 'attribute value';
410 case TokenKind.NUMBER: return 'number';
411 case TokenKind.HEX_NUMBER: return 'hex number';
412 case TokenKind.HTML_COMMENT: return 'HTML comment <!-- -->';
413 case TokenKind.IDENTIFIER: return 'identifier';
414 case TokenKind.STRING: return 'string';
415 case TokenKind.STRING_PART: return 'string part';
416 case TokenKind.TEMPLATE_KEYWORD: return 'template';
417 default:
418 throw "Unknown TOKEN";
419 }
420 }
421
422 TokenKind() {
423 tokens = [];
424
425 // All tokens must be in TokenKind order.
426 tokens.add(-1); // TokenKind.UNUSED
427 tokens.add(0); // TokenKind.END_OF_FILE match base
428 tokens.add(TokenKind.kindToString(TokenKind.LPAREN).codeUnitAt(0));
429 tokens.add(TokenKind.kindToString(TokenKind.RPAREN).codeUnitAt(0));
430 tokens.add(TokenKind.kindToString(TokenKind.LBRACK).codeUnitAt(0));
431 tokens.add(TokenKind.kindToString(TokenKind.RBRACK).codeUnitAt(0));
432 tokens.add(TokenKind.kindToString(TokenKind.LBRACE).codeUnitAt(0));
433 tokens.add(TokenKind.kindToString(TokenKind.RBRACE).codeUnitAt(0));
434 tokens.add(TokenKind.kindToString(TokenKind.DOT).codeUnitAt(0));
435 tokens.add(TokenKind.kindToString(TokenKind.SEMICOLON).codeUnitAt(0));
436 tokens.add(TokenKind.kindToString(TokenKind.SPACE).codeUnitAt(0));
437 tokens.add(TokenKind.kindToString(TokenKind.TAB).codeUnitAt(0));
438 tokens.add(TokenKind.kindToString(TokenKind.NEWLINE).codeUnitAt(0));
439 tokens.add(TokenKind.kindToString(TokenKind.RETURN).codeUnitAt(0));
440 tokens.add(TokenKind.kindToString(TokenKind.COMMA).codeUnitAt(0));
441 tokens.add(TokenKind.kindToString(TokenKind.LESS_THAN).codeUnitAt(0));
442 tokens.add(TokenKind.kindToString(TokenKind.GREATER_THAN).codeUnitAt(0));
443 tokens.add(TokenKind.kindToString(TokenKind.SLASH).codeUnitAt(0));
444 tokens.add(TokenKind.kindToString(TokenKind.DOLLAR).codeUnitAt(0));
445 tokens.add(TokenKind.kindToString(TokenKind.HASH).codeUnitAt(0));
446 tokens.add(TokenKind.kindToString(TokenKind.MINUS).codeUnitAt(0));
447 tokens.add(TokenKind.kindToString(TokenKind.EQUAL).codeUnitAt(0));
448 tokens.add(TokenKind.kindToString(TokenKind.DOUBLE_QUOTE).codeUnitAt(0));
449 tokens.add(TokenKind.kindToString(TokenKind.SINGLE_QUOTE).codeUnitAt(0));
450 tokens.add(TokenKind.kindToString(TokenKind.ASTERISK).codeUnitAt(0));
451
452 assert(tokens.length == TokenKind.END_TOKENS);
453 }
454
455 static bool isIdentifier(int kind) {
456 return kind == IDENTIFIER;
457 }
458 }
459
460 class NoElementMatchException implements Exception {
461 String _tagName;
462 NoElementMatchException(this._tagName);
463
464 String get name => _tagName;
465 }
OLDNEW
« no previous file with comments | « utils/template/tokenizer_base.dart ('k') | utils/template/tool.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698