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 csslib.parser; | 5 part of csslib.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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 const {'name': 'yellowgreen', 'value': 0x9ACD32}, | 460 const {'name': 'yellowgreen', 'value': 0x9ACD32}, |
461 ]; | 461 ]; |
462 | 462 |
463 // TODO(terry): Should used Dart mirroring for parameter values and types | 463 // TODO(terry): Should used Dart mirroring for parameter values and types |
464 // especially for enumeration (e.g., counter's second parameter | 464 // especially for enumeration (e.g., counter's second parameter |
465 // is list-style-type which is an enumerated list for ordering | 465 // is list-style-type which is an enumerated list for ordering |
466 // of a list 'circle', 'decimal', 'lower-roman', 'square', etc. | 466 // of a list 'circle', 'decimal', 'lower-roman', 'square', etc. |
467 // see http://www.w3schools.com/cssref/pr_list-style-type.asp | 467 // see http://www.w3schools.com/cssref/pr_list-style-type.asp |
468 // for list of possible values. | 468 // for list of possible values. |
469 | 469 |
470 // List of valid CSS functions: | |
471 static const List<Map<String, Object>> _FUNCTIONS = const [ | |
472 const {'name': 'counter', 'info': const {'params': 2, 'expr': false}}, | |
473 const {'name': 'attr', 'info': const {'params': 1, 'expr': false}}, | |
474 const {'name': 'calc', 'info': const {'params': 1, 'expr': true}}, | |
475 const {'name': 'min', 'info': const {'params': 2, 'expr': true}}, | |
476 const {'name': 'max', 'info': const {'params': 2, 'expr': true}}, | |
477 | |
478 // 2D functions: | |
479 const {'name': 'translateX', 'info': const {'params': 1, 'expr': false}}, | |
480 const {'name': 'translateY', 'info': const {'params': 1, 'expr': false}}, | |
481 const {'name': 'translate', 'info': const {'params': 2, 'expr': false}}, | |
482 const {'name': 'rotate', 'info': const {'params': 1, 'expr': false}}, | |
483 const {'name': 'scaleX', 'info': const {'params': 1, 'expr': false}}, | |
484 const {'name': 'scaleY', 'info': const {'params': 1, 'expr': false}}, | |
485 const {'name': 'scale', 'info': const {'params': 2, 'expr': false}}, | |
486 const {'name': 'skewX', 'info': const {'params': 1, 'expr': false}}, | |
487 const {'name': 'skewY', 'info': const {'params': 1, 'expr': false}}, | |
488 const {'name': 'skew', 'info': const {'params': 2, 'expr': false}}, | |
489 const {'name': 'matrix', 'info': const {'params': 6, 'expr': false}}, | |
490 | |
491 // 3D functions: | |
492 const {'name': 'matrix3d', 'info': const {'params': 16, 'expr': false}}, | |
493 const {'name': 'translate3d', 'info': const {'params': 3, 'expr': false}}, | |
494 const {'name': 'translateZ', 'info': const {'params': 1, 'expr': false}}, | |
495 const {'name': 'scale3d', 'info': const {'params': 3, 'expr': false}}, | |
496 const {'name': 'scaleZ', 'info': const {'params': 1, 'expr': false}}, | |
497 const {'name': 'rotate3d', 'info': const {'params': 3, 'expr': false}}, | |
498 const {'name': 'rotateX', 'info': const {'params': 1, 'expr': false}}, | |
499 const {'name': 'rotateY', 'info': const {'params': 1, 'expr': false}}, | |
500 const {'name': 'rotateZ', 'info': const {'params': 1, 'expr': false}}, | |
501 const {'name': 'perspective', 'info': const {'params': 1, 'expr': false}}, | |
502 ]; | |
503 | |
504 /** | 470 /** |
505 * Check if name is a pre-defined CSS name. Used by error handler to report | 471 * Check if name is a pre-defined CSS name. Used by error handler to report |
506 * if name is unknown or used improperly. | 472 * if name is unknown or used improperly. |
507 */ | 473 */ |
508 static bool isPredefinedName(String name) { | 474 static bool isPredefinedName(String name) { |
509 var nameLen = name.length; | 475 var nameLen = name.length; |
510 // TODO(terry): Add more pre-defined names (hidden, bolder, inherit, etc.). | 476 // TODO(terry): Add more pre-defined names (hidden, bolder, inherit, etc.). |
511 if (matchUnits(name, 0, nameLen) == -1 || | 477 if (matchUnits(name, 0, nameLen) == -1 || |
512 matchDirectives(name, 0, nameLen) == -1 || | 478 matchDirectives(name, 0, nameLen) == -1 || |
513 matchMarginDirectives(name, 0, nameLen) == -1 || | 479 matchMarginDirectives(name, 0, nameLen) == -1 || |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 static const int EQUALS = 0x3d; // "=".codeUnitAt(0) | 773 static const int EQUALS = 0x3d; // "=".codeUnitAt(0) |
808 static const int OR = 0x7c; // "|".codeUnitAt(0) | 774 static const int OR = 0x7c; // "|".codeUnitAt(0) |
809 static const int CARET = 0x5e; // "^".codeUnitAt(0) | 775 static const int CARET = 0x5e; // "^".codeUnitAt(0) |
810 static const int DOLLAR = 0x24; // "\$".codeUnitAt(0) | 776 static const int DOLLAR = 0x24; // "\$".codeUnitAt(0) |
811 static const int LESS = 0x3c; // "<".codeUnitAt(0) | 777 static const int LESS = 0x3c; // "<".codeUnitAt(0) |
812 static const int BANG = 0x21; // "!".codeUnitAt(0) | 778 static const int BANG = 0x21; // "!".codeUnitAt(0) |
813 static const int MINUS = 0x2d; // "-".codeUnitAt(0) | 779 static const int MINUS = 0x2d; // "-".codeUnitAt(0) |
814 static const int BACKSLASH = 0x5c; // "\".codeUnitAt(0) | 780 static const int BACKSLASH = 0x5c; // "\".codeUnitAt(0) |
815 static const int AMPERSAND = 0x26; // "&".codeUnitAt(0) | 781 static const int AMPERSAND = 0x26; // "&".codeUnitAt(0) |
816 } | 782 } |
OLD | NEW |