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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.write(', '); |
64 } | 64 } |
65 buff.add(selector.toString()); | 65 buff.write(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(); |
(...skipping 11 matching lines...) Expand all Loading... |
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.write(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; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.write(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. */ |
310 String toDebugString() { | 310 String toDebugString() { |
311 var to = new TreeOutput(); | 311 var to = new TreeOutput(); |
312 var tp = new TreePrinter(to); | 312 var tp = new TreePrinter(to); |
313 this.visit(tp); | 313 this.visit(tp); |
314 return to.buf.toString(); | 314 return to.buf.toString(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
360 | 360 |
361 visit(TreeVisitor visitor) => visitor.visitImportDirective(this); | 361 visit(TreeVisitor visitor) => visitor.visitImportDirective(this); |
362 | 362 |
363 String toString() { | 363 String toString() { |
364 StringBuffer buff = new StringBuffer(); | 364 StringBuffer buff = new StringBuffer(); |
365 | 365 |
366 buff.add('@import url(${_import})'); | 366 buff.write('@import url(${_import})'); |
367 | 367 |
368 int idx = 0; | 368 int idx = 0; |
369 for (final medium in _media) { | 369 for (final medium in _media) { |
370 buff.add(idx++ == 0 ? ' $medium' : ',$medium'); | 370 buff.write(idx++ == 0 ? ' $medium' : ',$medium'); |
371 } | 371 } |
372 buff.add('\n'); | 372 buff.write('\n'); |
373 | 373 |
374 return buff.toString(); | 374 return buff.toString(); |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 class MediaDirective extends Directive { | 378 class MediaDirective extends Directive { |
379 List<String> _media; | 379 List<String> _media; |
380 RuleSet _ruleset; | 380 RuleSet _ruleset; |
381 | 381 |
382 MediaDirective(this._media, this._ruleset, SourceSpan span) : | 382 MediaDirective(this._media, this._ruleset, SourceSpan span) : |
383 super(span); | 383 super(span); |
384 | 384 |
385 visit(TreeVisitor visitor) => visitor.visitMediaDirective(this); | 385 visit(TreeVisitor visitor) => visitor.visitMediaDirective(this); |
386 | 386 |
387 String toString() { | 387 String toString() { |
388 StringBuffer buff = new StringBuffer(); | 388 StringBuffer buff = new StringBuffer(); |
389 | 389 |
390 buff.add('@media'); | 390 buff.write('@media'); |
391 int idx = 0; | 391 int idx = 0; |
392 for (var medium in _media) { | 392 for (var medium in _media) { |
393 buff.add(idx++ == 0 ? ' $medium' : ',$medium'); | 393 buff.write(idx++ == 0 ? ' $medium' : ',$medium'); |
394 } | 394 } |
395 buff.add(' {\n'); | 395 buff.write(' {\n'); |
396 buff.add(_ruleset.toString()); | 396 buff.write(_ruleset.toString()); |
397 buff.add('\n\}\n'); | 397 buff.write('\n\}\n'); |
398 | 398 |
399 return buff.toString(); | 399 return buff.toString(); |
400 } | 400 } |
401 } | 401 } |
402 | 402 |
403 class PageDirective extends Directive { | 403 class PageDirective extends Directive { |
404 String _pseudoPage; | 404 String _pseudoPage; |
405 DeclarationGroup _decls; | 405 DeclarationGroup _decls; |
406 | 406 |
407 PageDirective(this._pseudoPage, this._decls, SourceSpan span) : | 407 PageDirective(this._pseudoPage, this._decls, SourceSpan span) : |
408 super(span); | 408 super(span); |
409 | 409 |
410 visit(TreeVisitor visitor) => visitor.visitPageDirective(this); | 410 visit(TreeVisitor visitor) => visitor.visitPageDirective(this); |
411 | 411 |
412 // @page : pseudoPage { | 412 // @page : pseudoPage { |
413 // decls | 413 // decls |
414 // } | 414 // } |
415 String toString() { | 415 String toString() { |
416 StringBuffer buff = new StringBuffer(); | 416 StringBuffer buff = new StringBuffer(); |
417 | 417 |
418 buff.add('@page '); | 418 buff.write('@page '); |
419 if (_pseudoPage != null) { | 419 if (_pseudoPage != null) { |
420 buff.add(': ${_pseudoPage} '); | 420 buff.write(': ${_pseudoPage} '); |
421 } | 421 } |
422 buff.add('{\n${_decls.toString()}\n}\n'); | 422 buff.write('{\n${_decls.toString()}\n}\n'); |
423 | 423 |
424 return buff.toString(); | 424 return buff.toString(); |
425 } | 425 } |
426 } | 426 } |
427 | 427 |
428 class KeyFrameDirective extends Directive { | 428 class KeyFrameDirective extends Directive { |
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.write('@-webkit-keyframes ${_name} {\n'); |
446 for (final block in _blocks) { | 446 for (final block in _blocks) { |
447 buff.add(block.toString()); | 447 buff.write(block.toString()); |
448 } | 448 } |
449 buff.add('}\n'); | 449 buff.write('}\n'); |
450 return buff.toString(); | 450 return buff.toString(); |
451 } | 451 } |
452 } | 452 } |
453 | 453 |
454 class KeyFrameBlock extends Expression { | 454 class KeyFrameBlock extends Expression { |
455 Expressions _blockSelectors; | 455 Expressions _blockSelectors; |
456 DeclarationGroup _declarations; | 456 DeclarationGroup _declarations; |
457 | 457 |
458 KeyFrameBlock(this._blockSelectors, this._declarations, SourceSpan span): | 458 KeyFrameBlock(this._blockSelectors, this._declarations, SourceSpan span): |
459 super(span); | 459 super(span); |
460 | 460 |
461 visit(TreeVisitor visitor) => visitor.visitKeyFrameBlock(this); | 461 visit(TreeVisitor visitor) => visitor.visitKeyFrameBlock(this); |
462 | 462 |
463 String toString() { | 463 String toString() { |
464 StringBuffer buff = new StringBuffer(); | 464 StringBuffer buff = new StringBuffer(); |
465 buff.add(' ${_blockSelectors.toString()} {\n'); | 465 buff.write(' ${_blockSelectors.toString()} {\n'); |
466 buff.add(_declarations.toString()); | 466 buff.write(_declarations.toString()); |
467 buff.add(' }\n'); | 467 buff.write(' }\n'); |
468 return buff.toString(); | 468 return buff.toString(); |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
472 // TODO(terry): TBD | 472 // TODO(terry): TBD |
473 class FontFaceDirective extends Directive { | 473 class FontFaceDirective extends Directive { |
474 List<Declaration> _declarations; | 474 List<Declaration> _declarations; |
475 | 475 |
476 FontFaceDirective(this._declarations, SourceSpan span) : super(span); | 476 FontFaceDirective(this._declarations, SourceSpan span) : super(span); |
477 | 477 |
(...skipping 13 matching lines...) Expand all Loading... |
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.write('/****** @include ${_include} ******/\n'); |
502 buff.add(_stylesheet != null ? _stylesheet.toString() : '// <EMPTY>'); | 502 buff.write(_stylesheet != null ? _stylesheet.toString() : '// <EMPTY>'); |
503 buff.add('/****** End of ${_include} ******/\n\n'); | 503 buff.write('/****** 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); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.write(" ${declaration.toString()};\n"); |
562 } | 562 } |
563 return buff.toString(); | 563 return buff.toString(); |
564 } | 564 } |
565 } | 565 } |
566 | 566 |
567 class OperatorSlash extends Expression { | 567 class OperatorSlash extends Expression { |
568 OperatorSlash(SourceSpan span) : super(span); | 568 OperatorSlash(SourceSpan span) : super(span); |
569 | 569 |
570 visit(TreeVisitor visitor) => visitor.visitOperatorSlash(this); | 570 visit(TreeVisitor visitor) => visitor.visitOperatorSlash(this); |
571 | 571 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 | 718 |
719 FunctionTerm(var value, String t, this._params, SourceSpan span) | 719 FunctionTerm(var value, String t, this._params, SourceSpan span) |
720 : super(value, t, span); | 720 : super(value, t, span); |
721 | 721 |
722 visit(TreeVisitor visitor) => visitor.visitFunctionTerm(this); | 722 visit(TreeVisitor visitor) => visitor.visitFunctionTerm(this); |
723 | 723 |
724 String toString() { | 724 String toString() { |
725 // TODO(terry): Optimize rgb to a hexcolor. | 725 // TODO(terry): Optimize rgb to a hexcolor. |
726 StringBuffer buff = new StringBuffer(); | 726 StringBuffer buff = new StringBuffer(); |
727 | 727 |
728 buff.add('${text}('); | 728 buff.write('${text}('); |
729 buff.add(_params.toString()); | 729 buff.write(_params.toString()); |
730 buff.add(')'); | 730 buff.write(')'); |
731 | 731 |
732 return buff.toString(); | 732 return buff.toString(); |
733 } | 733 } |
734 } | 734 } |
735 | 735 |
736 class GroupTerm extends Expression { | 736 class GroupTerm extends Expression { |
737 List<LiteralTerm> _terms; | 737 List<LiteralTerm> _terms; |
738 | 738 |
739 GroupTerm(SourceSpan span) : _terms = [], super(span); | 739 GroupTerm(SourceSpan span) : _terms = [], super(span); |
740 | 740 |
741 add(LiteralTerm term) { | 741 add(LiteralTerm term) { |
742 _terms.add(term); | 742 _terms.add(term); |
743 } | 743 } |
744 | 744 |
745 visit(TreeVisitor visitor) => visitor.visitGroupTerm(this); | 745 visit(TreeVisitor visitor) => visitor.visitGroupTerm(this); |
746 | 746 |
747 String toString() { | 747 String toString() { |
748 StringBuffer buff = new StringBuffer(); | 748 StringBuffer buff = new StringBuffer(); |
749 buff.add('('); | 749 buff.write('('); |
750 int idx = 0; | 750 int idx = 0; |
751 for (final term in _terms) { | 751 for (final term in _terms) { |
752 if (idx++ > 0) { | 752 if (idx++ > 0) { |
753 buff.add(' '); | 753 buff.write(' '); |
754 } | 754 } |
755 buff.add(term.toString()); | 755 buff.write(term.toString()); |
756 } | 756 } |
757 buff.add(')'); | 757 buff.write(')'); |
758 return buff.toString(); | 758 return buff.toString(); |
759 } | 759 } |
760 } | 760 } |
761 | 761 |
762 class ItemTerm extends NumberTerm { | 762 class ItemTerm extends NumberTerm { |
763 ItemTerm(var value, String t, SourceSpan span) : super(value, t, span); | 763 ItemTerm(var value, String t, SourceSpan span) : super(value, t, span); |
764 | 764 |
765 visit(TreeVisitor visitor) => visitor.visitItemTerm(this); | 765 visit(TreeVisitor visitor) => visitor.visitItemTerm(this); |
766 | 766 |
767 String toString() => '[${text}]'; | 767 String toString() => '[${text}]'; |
(...skipping 13 matching lines...) Expand all Loading... |
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 && |
790 !(expression is OperatorComma || expression is OperatorSlash)) { | 790 !(expression is OperatorComma || expression is OperatorSlash)) { |
791 buff.add(' '); | 791 buff.write(' '); |
792 } | 792 } |
793 buff.add(expression.toString()); | 793 buff.write(expression.toString()); |
794 idx++; | 794 idx++; |
795 } | 795 } |
796 return buff.toString(); | 796 return buff.toString(); |
797 } | 797 } |
798 } | 798 } |
799 | 799 |
800 class BinaryExpression extends Expression { | 800 class BinaryExpression extends Expression { |
801 Token op; | 801 Token op; |
802 Expression x; | 802 Expression x; |
803 Expression y; | 803 Expression y; |
(...skipping 466 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 |