| OLD | NEW |
| 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 // Generated by scripts/tree_gen.py. | 4 // Generated by scripts/tree_gen.py. |
| 5 | 5 |
| 6 ///////////////////////////////////////////////////////////////////////// | 6 ///////////////////////////////////////////////////////////////////////// |
| 7 // CSS specific types: | 7 // CSS specific types: |
| 8 ///////////////////////////////////////////////////////////////////////// | 8 ///////////////////////////////////////////////////////////////////////// |
| 9 | 9 |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 visit(TreeVisitor visitor) => visitor.visitCommentDefinition(this); | 44 visit(TreeVisitor visitor) => visitor.visitCommentDefinition(this); |
| 45 | 45 |
| 46 String toString() => '<!-- ${comment} -->'; | 46 String toString() => '<!-- ${comment} -->'; |
| 47 } | 47 } |
| 48 | 48 |
| 49 class SelectorGroup extends ASTNode { | 49 class SelectorGroup extends ASTNode { |
| 50 List<Selector> _selectors; | 50 List<Selector> _selectors; |
| 51 | 51 |
| 52 SelectorGroup(this._selectors, SourceSpan span): super(span); | 52 SelectorGroup(this._selectors, SourceSpan span): super(span); |
| 53 | 53 |
| 54 List<Selector> get selectors() => _selectors; | 54 List<Selector> get selectors => _selectors; |
| 55 | 55 |
| 56 visit(TreeVisitor visitor) => visitor.visitSelectorGroup(this); | 56 visit(TreeVisitor visitor) => visitor.visitSelectorGroup(this); |
| 57 | 57 |
| 58 String toString() { | 58 String toString() { |
| 59 StringBuffer buff = new StringBuffer(); | 59 StringBuffer buff = new StringBuffer(); |
| 60 int idx = 0; | 60 int idx = 0; |
| 61 for (final selector in _selectors) { | 61 for (final selector in _selectors) { |
| 62 if (idx++ > 0) { | 62 if (idx++ > 0) { |
| 63 buff.add(', '); | 63 buff.add(', '); |
| 64 } | 64 } |
| 65 buff.add(selector.toString()); | 65 buff.add(selector.toString()); |
| 66 } | 66 } |
| 67 return buff.toString(); | 67 return buff.toString(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 /** A multiline string showing the node and its children. */ | 70 /** A multiline string showing the node and its children. */ |
| 71 String toDebugString() { | 71 String toDebugString() { |
| 72 var to = new TreeOutput(); | 72 var to = new TreeOutput(); |
| 73 var tp = new TreePrinter(to); | 73 var tp = new TreePrinter(to); |
| 74 this.visit(tp); | 74 this.visit(tp); |
| 75 return to.buf.toString(); | 75 return to.buf.toString(); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 class Selector extends ASTNode { | 79 class Selector extends ASTNode { |
| 80 List<SimpleSelectorSequence> _simpleSelectorSequences; | 80 List<SimpleSelectorSequence> _simpleSelectorSequences; |
| 81 | 81 |
| 82 Selector(this._simpleSelectorSequences, SourceSpan span) : super(span); | 82 Selector(this._simpleSelectorSequences, SourceSpan span) : super(span); |
| 83 | 83 |
| 84 List<SimpleSelectorSequence> get simpleSelectorSequences() => | 84 List<SimpleSelectorSequence> get simpleSelectorSequences => |
| 85 _simpleSelectorSequences; | 85 _simpleSelectorSequences; |
| 86 | 86 |
| 87 add(SimpleSelectorSequence seq) => _simpleSelectorSequences.add(seq); | 87 add(SimpleSelectorSequence seq) => _simpleSelectorSequences.add(seq); |
| 88 | 88 |
| 89 List<SimpleSelectorSequence> get simpleSelectorSquences() => | 89 List<SimpleSelectorSequence> get simpleSelectorSquences => |
| 90 _simpleSelectorSequences; | 90 _simpleSelectorSequences; |
| 91 | 91 |
| 92 int get length() => _simpleSelectorSequences.length; | 92 int get length => _simpleSelectorSequences.length; |
| 93 | 93 |
| 94 String toString() { | 94 String toString() { |
| 95 StringBuffer buff = new StringBuffer(); | 95 StringBuffer buff = new StringBuffer(); |
| 96 for (final simpleSelectorSequence in _simpleSelectorSequences) { | 96 for (final simpleSelectorSequence in _simpleSelectorSequences) { |
| 97 buff.add(simpleSelectorSequence.toString()); | 97 buff.add(simpleSelectorSequence.toString()); |
| 98 } | 98 } |
| 99 return buff.toString(); | 99 return buff.toString(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 visit(TreeVisitor visitor) => visitor.visitSelector(this); | 102 visit(TreeVisitor visitor) => visitor.visitSelector(this); |
| 103 } | 103 } |
| 104 | 104 |
| 105 class SimpleSelectorSequence extends ASTNode { | 105 class SimpleSelectorSequence extends ASTNode { |
| 106 int _combinator; // +, >, ~, NONE | 106 int _combinator; // +, >, ~, NONE |
| 107 SimpleSelector _selector; | 107 SimpleSelector _selector; |
| 108 | 108 |
| 109 SimpleSelectorSequence(this._selector, SourceSpan span, | 109 SimpleSelectorSequence(this._selector, SourceSpan span, |
| 110 [this._combinator = TokenKind.COMBINATOR_NONE]) : super(span); | 110 [this._combinator = TokenKind.COMBINATOR_NONE]) : super(span); |
| 111 | 111 |
| 112 get simpleSelector() => _selector; | 112 get simpleSelector => _selector; |
| 113 | 113 |
| 114 bool isCombinatorNone() => _combinator == TokenKind.COMBINATOR_NONE; | 114 bool isCombinatorNone() => _combinator == TokenKind.COMBINATOR_NONE; |
| 115 bool isCombinatorPlus() => _combinator == TokenKind.COMBINATOR_PLUS; | 115 bool isCombinatorPlus() => _combinator == TokenKind.COMBINATOR_PLUS; |
| 116 bool isCombinatorGreater() => _combinator == TokenKind.COMBINATOR_GREATER; | 116 bool isCombinatorGreater() => _combinator == TokenKind.COMBINATOR_GREATER; |
| 117 bool isCombinatorTilde() => _combinator == TokenKind.COMBINATOR_TILDE; | 117 bool isCombinatorTilde() => _combinator == TokenKind.COMBINATOR_TILDE; |
| 118 bool isCombinatorDescendant() => | 118 bool isCombinatorDescendant() => |
| 119 _combinator == TokenKind.COMBINATOR_DESCENDANT; | 119 _combinator == TokenKind.COMBINATOR_DESCENDANT; |
| 120 | 120 |
| 121 String _combinatorToString() => | 121 String _combinatorToString() => |
| 122 isCombinatorDescendant() ? ' ' : | 122 isCombinatorDescendant() ? ' ' : |
| 123 isCombinatorPlus() ? '+' : | 123 isCombinatorPlus() ? '+' : |
| 124 isCombinatorGreater() ? '>' : | 124 isCombinatorGreater() ? '>' : |
| 125 isCombinatorTilde() ? '~' : ''; | 125 isCombinatorTilde() ? '~' : ''; |
| 126 | 126 |
| 127 visit(TreeVisitor visitor) => visitor.visitSimpleSelectorSequence(this); | 127 visit(TreeVisitor visitor) => visitor.visitSimpleSelectorSequence(this); |
| 128 | 128 |
| 129 String toString() => _combinatorToString() + _selector.toString(); | 129 String toString() => _combinatorToString() + _selector.toString(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 /* All other selectors (element, #id, .class, attribute, pseudo, negation, | 132 /* All other selectors (element, #id, .class, attribute, pseudo, negation, |
| 133 * namespace, *) are derived from this selector. | 133 * namespace, *) are derived from this selector. |
| 134 */ | 134 */ |
| 135 class SimpleSelector extends ASTNode { | 135 class SimpleSelector extends ASTNode { |
| 136 var _name; | 136 var _name; |
| 137 | 137 |
| 138 SimpleSelector(this._name, SourceSpan span) : super(span); | 138 SimpleSelector(this._name, SourceSpan span) : super(span); |
| 139 | 139 |
| 140 // Name can be an Identifier or WildCard we'll return either the name or '*'. | 140 // Name can be an Identifier or WildCard we'll return either the name or '*'. |
| 141 String get name() => isWildcard() ? '*' : _name.name; | 141 String get name => isWildcard() ? '*' : _name.name; |
| 142 | 142 |
| 143 bool isWildcard() => _name is Wildcard; | 143 bool isWildcard() => _name is Wildcard; |
| 144 | 144 |
| 145 visit(TreeVisitor visitor) => visitor.visitSimpleSelector(this); | 145 visit(TreeVisitor visitor) => visitor.visitSimpleSelector(this); |
| 146 | 146 |
| 147 String toString() => name; | 147 String toString() => name; |
| 148 } | 148 } |
| 149 | 149 |
| 150 // element name | 150 // element name |
| 151 class ElementSelector extends SimpleSelector { | 151 class ElementSelector extends SimpleSelector { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 // namespace|element | 167 // namespace|element |
| 168 class NamespaceSelector extends SimpleSelector { | 168 class NamespaceSelector extends SimpleSelector { |
| 169 var _namespace; // null, Wildcard or Identifier | 169 var _namespace; // null, Wildcard or Identifier |
| 170 | 170 |
| 171 NamespaceSelector(this._namespace, var name, SourceSpan span) : | 171 NamespaceSelector(this._namespace, var name, SourceSpan span) : |
| 172 super(name, span); | 172 super(name, span); |
| 173 | 173 |
| 174 String get namespace() => _namespace is Wildcard ? '*' : _namespace.name; | 174 String get namespace => _namespace is Wildcard ? '*' : _namespace.name; |
| 175 | 175 |
| 176 bool isNamespaceWildcard() => _namespace is Wildcard; | 176 bool isNamespaceWildcard() => _namespace is Wildcard; |
| 177 | 177 |
| 178 SimpleSelector get nameAsSimpleSelector() => _name; | 178 SimpleSelector get nameAsSimpleSelector => _name; |
| 179 | 179 |
| 180 visit(TreeVisitor visitor) => visitor.visitNamespaceSelector(this); | 180 visit(TreeVisitor visitor) => visitor.visitNamespaceSelector(this); |
| 181 | 181 |
| 182 String toString() => "$namespace|${nameAsSimpleSelector.name}"; | 182 String toString() => "$namespace|${nameAsSimpleSelector.name}"; |
| 183 } | 183 } |
| 184 | 184 |
| 185 // [attr op value] | 185 // [attr op value] |
| 186 class AttributeSelector extends SimpleSelector { | 186 class AttributeSelector extends SimpleSelector { |
| 187 int _op; | 187 int _op; |
| 188 var _value; | 188 var _value; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 List<ASTNode> _topLevels; | 289 List<ASTNode> _topLevels; |
| 290 | 290 |
| 291 Stylesheet(this._topLevels, SourceSpan span) : super(span) { | 291 Stylesheet(this._topLevels, SourceSpan span) : super(span) { |
| 292 for (final node in _topLevels) { | 292 for (final node in _topLevels) { |
| 293 assert(node is TopLevelProduction || node is Directive); | 293 assert(node is TopLevelProduction || node is Directive); |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 | 296 |
| 297 visit(TreeVisitor visitor) => visitor.visitStylesheet(this); | 297 visit(TreeVisitor visitor) => visitor.visitStylesheet(this); |
| 298 | 298 |
| 299 List<ASTNode> get topLevels() => _topLevels; | 299 List<ASTNode> get topLevels => _topLevels; |
| 300 | 300 |
| 301 String toString() { | 301 String toString() { |
| 302 StringBuffer buff = new StringBuffer(); | 302 StringBuffer buff = new StringBuffer(); |
| 303 for (final topLevel in _topLevels) { | 303 for (final topLevel in _topLevels) { |
| 304 buff.add(topLevel.toString()); | 304 buff.add(topLevel.toString()); |
| 305 } | 305 } |
| 306 return buff.toString(); | 306 return buff.toString(); |
| 307 } | 307 } |
| 308 | 308 |
| 309 /** A multiline string showing the node and its children. */ | 309 /** A multiline string showing the node and its children. */ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 323 String toString() => "TopLevelProduction"; | 323 String toString() => "TopLevelProduction"; |
| 324 } | 324 } |
| 325 | 325 |
| 326 class RuleSet extends TopLevelProduction { | 326 class RuleSet extends TopLevelProduction { |
| 327 SelectorGroup _selectorGroup; | 327 SelectorGroup _selectorGroup; |
| 328 DeclarationGroup _declarationGroup; | 328 DeclarationGroup _declarationGroup; |
| 329 | 329 |
| 330 RuleSet(this._selectorGroup, this._declarationGroup, SourceSpan span) : | 330 RuleSet(this._selectorGroup, this._declarationGroup, SourceSpan span) : |
| 331 super(span); | 331 super(span); |
| 332 | 332 |
| 333 SelectorGroup get selectorGroup() => _selectorGroup; | 333 SelectorGroup get selectorGroup => _selectorGroup; |
| 334 DeclarationGroup get declarationGroup() => _declarationGroup; | 334 DeclarationGroup get declarationGroup => _declarationGroup; |
| 335 | 335 |
| 336 visit(TreeVisitor visitor) => visitor.visitRuleSet(this); | 336 visit(TreeVisitor visitor) => visitor.visitRuleSet(this); |
| 337 | 337 |
| 338 String toString() => | 338 String toString() => |
| 339 "\n${_selectorGroup.toString()} {\n" + | 339 "\n${_selectorGroup.toString()} {\n" + |
| 340 "${_declarationGroup.toString()}}\n"; | 340 "${_declarationGroup.toString()}}\n"; |
| 341 } | 341 } |
| 342 | 342 |
| 343 class Directive extends ASTNode { | 343 class Directive extends ASTNode { |
| 344 Directive(SourceSpan span) : super(span); | 344 Directive(SourceSpan span) : super(span); |
| 345 | 345 |
| 346 String toString() => "Directive"; | 346 String toString() => "Directive"; |
| 347 | 347 |
| 348 bool get isBuiltIn() => true; // Known CSS directive? | 348 bool get isBuiltIn => true; // Known CSS directive? |
| 349 bool get isExtension() => false; // SCSS extension? | 349 bool get isExtension => false; // SCSS extension? |
| 350 | 350 |
| 351 visit(TreeVisitor visitor) => visitor.visitDirective(this); | 351 visit(TreeVisitor visitor) => visitor.visitDirective(this); |
| 352 } | 352 } |
| 353 | 353 |
| 354 class ImportDirective extends Directive { | 354 class ImportDirective extends Directive { |
| 355 String _import; | 355 String _import; |
| 356 List<String> _media; | 356 List<String> _media; |
| 357 | 357 |
| 358 ImportDirective(this._import, this._media, SourceSpan span) : | 358 ImportDirective(this._import, this._media, SourceSpan span) : |
| 359 super(span); | 359 super(span); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 var _name; | 429 var _name; |
| 430 List<KeyFrameBlock> _blocks; | 430 List<KeyFrameBlock> _blocks; |
| 431 | 431 |
| 432 KeyFrameDirective(this._name, SourceSpan span) : | 432 KeyFrameDirective(this._name, SourceSpan span) : |
| 433 _blocks = [], super(span); | 433 _blocks = [], super(span); |
| 434 | 434 |
| 435 add(KeyFrameBlock block) { | 435 add(KeyFrameBlock block) { |
| 436 _blocks.add(block); | 436 _blocks.add(block); |
| 437 } | 437 } |
| 438 | 438 |
| 439 String get name() => _name; | 439 String get name => _name; |
| 440 | 440 |
| 441 visit(TreeVisitor visitor) => visitor.visitKeyFrameDirective(this); | 441 visit(TreeVisitor visitor) => visitor.visitKeyFrameDirective(this); |
| 442 | 442 |
| 443 String toString() { | 443 String toString() { |
| 444 StringBuffer buff = new StringBuffer(); | 444 StringBuffer buff = new StringBuffer(); |
| 445 buff.add('@-webkit-keyframes ${_name} {\n'); | 445 buff.add('@-webkit-keyframes ${_name} {\n'); |
| 446 for (final block in _blocks) { | 446 for (final block in _blocks) { |
| 447 buff.add(block.toString()); | 447 buff.add(block.toString()); |
| 448 } | 448 } |
| 449 buff.add('}\n'); | 449 buff.add('}\n'); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 | 484 |
| 485 class IncludeDirective extends Directive { | 485 class IncludeDirective extends Directive { |
| 486 String _include; | 486 String _include; |
| 487 Stylesheet _stylesheet; | 487 Stylesheet _stylesheet; |
| 488 | 488 |
| 489 IncludeDirective(this._include, this._stylesheet, SourceSpan span) : | 489 IncludeDirective(this._include, this._stylesheet, SourceSpan span) : |
| 490 super(span); | 490 super(span); |
| 491 | 491 |
| 492 visit(TreeVisitor visitor) => visitor.visitIncludeDirective(this); | 492 visit(TreeVisitor visitor) => visitor.visitIncludeDirective(this); |
| 493 | 493 |
| 494 bool get isBuiltIn() => false; | 494 bool get isBuiltIn => false; |
| 495 bool get isExtension() => true; | 495 bool get isExtension => true; |
| 496 | 496 |
| 497 Stylesheet get styleSheet() => _stylesheet; | 497 Stylesheet get styleSheet => _stylesheet; |
| 498 | 498 |
| 499 String toString() { | 499 String toString() { |
| 500 StringBuffer buff = new StringBuffer(); | 500 StringBuffer buff = new StringBuffer(); |
| 501 buff.add('/****** @include ${_include} ******/\n'); | 501 buff.add('/****** @include ${_include} ******/\n'); |
| 502 buff.add(_stylesheet != null ? _stylesheet.toString() : '// <EMPTY>'); | 502 buff.add(_stylesheet != null ? _stylesheet.toString() : '// <EMPTY>'); |
| 503 buff.add('/****** End of ${_include} ******/\n\n'); | 503 buff.add('/****** End of ${_include} ******/\n\n'); |
| 504 return buff.toString(); | 504 return buff.toString(); |
| 505 } | 505 } |
| 506 } | 506 } |
| 507 | 507 |
| 508 class StyletDirective extends Directive { | 508 class StyletDirective extends Directive { |
| 509 String _dartClassName; | 509 String _dartClassName; |
| 510 List<RuleSet> _rulesets; | 510 List<RuleSet> _rulesets; |
| 511 | 511 |
| 512 StyletDirective(this._dartClassName, this._rulesets, SourceSpan span) : | 512 StyletDirective(this._dartClassName, this._rulesets, SourceSpan span) : |
| 513 super(span); | 513 super(span); |
| 514 | 514 |
| 515 bool get isBuiltIn() => false; | 515 bool get isBuiltIn => false; |
| 516 bool get isExtension() => true; | 516 bool get isExtension => true; |
| 517 | 517 |
| 518 String get dartClassName() => _dartClassName; | 518 String get dartClassName => _dartClassName; |
| 519 List<RuleSet> get rulesets() => _rulesets; | 519 List<RuleSet> get rulesets => _rulesets; |
| 520 | 520 |
| 521 visit(TreeVisitor visitor) => visitor.visitStyletDirective(this); | 521 visit(TreeVisitor visitor) => visitor.visitStyletDirective(this); |
| 522 | 522 |
| 523 // TODO(terry): Output Dart class | 523 // TODO(terry): Output Dart class |
| 524 String toString() => '/* @stylet export as ${_dartClassName} */\n'; | 524 String toString() => '/* @stylet export as ${_dartClassName} */\n'; |
| 525 } | 525 } |
| 526 | 526 |
| 527 class Declaration extends ASTNode { | 527 class Declaration extends ASTNode { |
| 528 Identifier _property; | 528 Identifier _property; |
| 529 Expression _expression; | 529 Expression _expression; |
| 530 bool _important; | 530 bool _important; |
| 531 | 531 |
| 532 Declaration(this._property, this._expression, SourceSpan span) : | 532 Declaration(this._property, this._expression, SourceSpan span) : |
| 533 _important = false, super(span); | 533 _important = false, super(span); |
| 534 | 534 |
| 535 String get property() => _property.name; | 535 String get property => _property.name; |
| 536 Expression get expression() => _expression; | 536 Expression get expression => _expression; |
| 537 | 537 |
| 538 bool get important() => _important; | 538 bool get important => _important; |
| 539 set important(bool value) => _important = value; | 539 set important(bool value) => _important = value; |
| 540 String importantAsString() => _important ? ' !important' : ''; | 540 String importantAsString() => _important ? ' !important' : ''; |
| 541 | 541 |
| 542 visit(TreeVisitor visitor) => visitor.visitDeclaration(this); | 542 visit(TreeVisitor visitor) => visitor.visitDeclaration(this); |
| 543 | 543 |
| 544 String toString() => | 544 String toString() => |
| 545 "${_property.name}: ${_expression.toString()}${importantAsString()}"; | 545 "${_property.name}: ${_expression.toString()}${importantAsString()}"; |
| 546 } | 546 } |
| 547 | 547 |
| 548 class DeclarationGroup extends ASTNode { | 548 class DeclarationGroup extends ASTNode { |
| 549 List<Declaration> _declarations; | 549 List<Declaration> _declarations; |
| 550 | 550 |
| 551 DeclarationGroup(this._declarations, SourceSpan span) : super(span); | 551 DeclarationGroup(this._declarations, SourceSpan span) : super(span); |
| 552 | 552 |
| 553 List<Declaration> get declarations() => _declarations; | 553 List<Declaration> get declarations => _declarations; |
| 554 | 554 |
| 555 visit(TreeVisitor visitor) => visitor.visitDeclarationGroup(this); | 555 visit(TreeVisitor visitor) => visitor.visitDeclarationGroup(this); |
| 556 | 556 |
| 557 String toString() { | 557 String toString() { |
| 558 StringBuffer buff = new StringBuffer(); | 558 StringBuffer buff = new StringBuffer(); |
| 559 int idx = 0; | 559 int idx = 0; |
| 560 for (final declaration in _declarations) { | 560 for (final declaration in _declarations) { |
| 561 buff.add(" ${declaration.toString()};\n"); | 561 buff.add(" ${declaration.toString()};\n"); |
| 562 } | 562 } |
| 563 return buff.toString(); | 563 return buff.toString(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 579 | 579 |
| 580 String toString() => ','; | 580 String toString() => ','; |
| 581 } | 581 } |
| 582 | 582 |
| 583 class LiteralTerm extends Expression { | 583 class LiteralTerm extends Expression { |
| 584 var _value; | 584 var _value; |
| 585 String _text; | 585 String _text; |
| 586 | 586 |
| 587 LiteralTerm(this._value, this._text, SourceSpan span) : super(span); | 587 LiteralTerm(this._value, this._text, SourceSpan span) : super(span); |
| 588 | 588 |
| 589 get value() => _value; | 589 get value => _value; |
| 590 String get text() => _text; | 590 String get text => _text; |
| 591 | 591 |
| 592 visit(TreeVisitor visitor) => visitor.visitLiteralTerm(this); | 592 visit(TreeVisitor visitor) => visitor.visitLiteralTerm(this); |
| 593 | 593 |
| 594 String toString() => _text; | 594 String toString() => _text; |
| 595 } | 595 } |
| 596 | 596 |
| 597 class NumberTerm extends LiteralTerm { | 597 class NumberTerm extends LiteralTerm { |
| 598 NumberTerm(var value, String t, SourceSpan span) : super(value, t, span); | 598 NumberTerm(var value, String t, SourceSpan span) : super(value, t, span); |
| 599 | 599 |
| 600 visit(TreeVisitor visitor) => visitor.visitNumberTerm(this); | 600 visit(TreeVisitor visitor) => visitor.visitNumberTerm(this); |
| 601 } | 601 } |
| 602 | 602 |
| 603 class UnitTerm extends LiteralTerm { | 603 class UnitTerm extends LiteralTerm { |
| 604 int _unit; | 604 int _unit; |
| 605 | 605 |
| 606 UnitTerm(var value, String t, SourceSpan span, this._unit) : | 606 UnitTerm(var value, String t, SourceSpan span, this._unit) : |
| 607 super(value, t, span); | 607 super(value, t, span); |
| 608 | 608 |
| 609 int get unit() => _unit; | 609 int get unit => _unit; |
| 610 | 610 |
| 611 visit(TreeVisitor visitor) => visitor.visitUnitTerm(this); | 611 visit(TreeVisitor visitor) => visitor.visitUnitTerm(this); |
| 612 | 612 |
| 613 String toString() => '${text}${unitToString()}'; | 613 String toString() => '${text}${unitToString()}'; |
| 614 String unitToString() => TokenKind.unitToString(_unit); | 614 String unitToString() => TokenKind.unitToString(_unit); |
| 615 } | 615 } |
| 616 | 616 |
| 617 class LengthTerm extends UnitTerm { | 617 class LengthTerm extends UnitTerm { |
| 618 LengthTerm(var value, String t, SourceSpan span, | 618 LengthTerm(var value, String t, SourceSpan span, |
| 619 [int unit = TokenKind.UNIT_LENGTH_PX]) : super(value, t, span, unit) { | 619 [int unit = TokenKind.UNIT_LENGTH_PX]) : super(value, t, span, unit) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 | 769 |
| 770 class Expressions extends Expression { | 770 class Expressions extends Expression { |
| 771 List<Expression> _expressions; | 771 List<Expression> _expressions; |
| 772 | 772 |
| 773 Expressions(SourceSpan span): super(span), _expressions = []; | 773 Expressions(SourceSpan span): super(span), _expressions = []; |
| 774 | 774 |
| 775 add(Expression expression) { | 775 add(Expression expression) { |
| 776 _expressions.add(expression); | 776 _expressions.add(expression); |
| 777 } | 777 } |
| 778 | 778 |
| 779 List<Expression> get expressions() => _expressions; | 779 List<Expression> get expressions => _expressions; |
| 780 | 780 |
| 781 visit(TreeVisitor visitor) => visitor.visitExpressions(this); | 781 visit(TreeVisitor visitor) => visitor.visitExpressions(this); |
| 782 | 782 |
| 783 String toString() { | 783 String toString() { |
| 784 StringBuffer buff = new StringBuffer(); | 784 StringBuffer buff = new StringBuffer(); |
| 785 int idx = 0; | 785 int idx = 0; |
| 786 for (final expression in _expressions) { | 786 for (final expression in _expressions) { |
| 787 // Add space seperator between terms without an operator. | 787 // Add space seperator between terms without an operator. |
| 788 // TODO(terry): Should have a BinaryExpression to solve this problem. | 788 // TODO(terry): Should have a BinaryExpression to solve this problem. |
| 789 if (idx > 0 && | 789 if (idx > 0 && |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 | 1270 |
| 1271 void visitWildcard(Wildcard node) { | 1271 void visitWildcard(Wildcard node) { |
| 1272 output.heading('Wildcard(*)', node.span); | 1272 output.heading('Wildcard(*)', node.span); |
| 1273 } | 1273 } |
| 1274 | 1274 |
| 1275 // TODO(terry): Defined for frog/tree.dart. | 1275 // TODO(terry): Defined for frog/tree.dart. |
| 1276 void visitTypeReference(TypeReference node) { | 1276 void visitTypeReference(TypeReference node) { |
| 1277 output.heading('Unimplemented'); | 1277 output.heading('Unimplemented'); |
| 1278 } | 1278 } |
| 1279 } | 1279 } |
| OLD | NEW |