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

Side by Side Diff: packages/csslib/lib/src/tree.dart

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « packages/csslib/lib/src/tokenkind.dart ('k') | packages/csslib/lib/src/tree_printer.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) 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.visitor; 5 part of csslib.visitor;
6 6
7 ///////////////////////////////////////////////////////////////////////// 7 /////////////////////////////////////////////////////////////////////////
8 // CSS specific types: 8 // CSS specific types:
9 ///////////////////////////////////////////////////////////////////////// 9 /////////////////////////////////////////////////////////////////////////
10 10
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 class Negation extends TreeNode { 39 class Negation extends TreeNode {
40 Negation(SourceSpan span) : super(span); 40 Negation(SourceSpan span) : super(span);
41 Negation clone() => new Negation(span); 41 Negation clone() => new Negation(span);
42 visit(VisitorBase visitor) => visitor.visitNegation(this); 42 visit(VisitorBase visitor) => visitor.visitNegation(this);
43 43
44 String get name => 'not'; 44 String get name => 'not';
45 } 45 }
46 46
47 // calc(...)
48 // TODO(terry): Hack to handle calc however the expressions should be fully
49 // parsed and in the AST.
50 class CalcTerm extends LiteralTerm {
51 final LiteralTerm expr;
52
53 CalcTerm(var value, String t, this.expr, SourceSpan span)
54 : super(value, t, span);
55
56 CalcTerm clone() => new CalcTerm(value, text, expr.clone(), span);
57 visit(VisitorBase visitor) => visitor.visitCalcTerm(this);
58
59 String toString() => "$text($expr)";
60 }
61
47 // /* .... */ 62 // /* .... */
48 class CssComment extends TreeNode { 63 class CssComment extends TreeNode {
49 final String comment; 64 final String comment;
50 65
51 CssComment(this.comment, SourceSpan span) : super(span); 66 CssComment(this.comment, SourceSpan span) : super(span);
52 CssComment clone() => new CssComment(comment, span); 67 CssComment clone() => new CssComment(comment, span);
53 visit(VisitorBase visitor) => visitor.visitCssComment(this); 68 visit(VisitorBase visitor) => visitor.visitCssComment(this);
54 } 69 }
55 70
56 // CDO/CDC (Comment Definition Open <!-- and Comment Definition Close -->). 71 // CDO/CDC (Comment Definition Open <!-- and Comment Definition Close -->).
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 return '|='; 205 return '|=';
191 case TokenKind.PREFIX_MATCH: 206 case TokenKind.PREFIX_MATCH:
192 return '^='; 207 return '^=';
193 case TokenKind.SUFFIX_MATCH: 208 case TokenKind.SUFFIX_MATCH:
194 return '\$='; 209 return '\$=';
195 case TokenKind.SUBSTRING_MATCH: 210 case TokenKind.SUBSTRING_MATCH:
196 return '*='; 211 return '*=';
197 case TokenKind.NO_MATCH: 212 case TokenKind.NO_MATCH:
198 return ''; 213 return '';
199 } 214 }
215 return null;
200 } 216 }
201 217
202 // Return the TokenKind for operator used by visitAttributeSelector. 218 // Return the TokenKind for operator used by visitAttributeSelector.
203 String matchOperatorAsTokenString() { 219 String matchOperatorAsTokenString() {
204 switch (_op) { 220 switch (_op) {
205 case TokenKind.EQUALS: 221 case TokenKind.EQUALS:
206 return 'EQUALS'; 222 return 'EQUALS';
207 case TokenKind.INCLUDES: 223 case TokenKind.INCLUDES:
208 return 'INCLUDES'; 224 return 'INCLUDES';
209 case TokenKind.DASH_MATCH: 225 case TokenKind.DASH_MATCH:
210 return 'DASH_MATCH'; 226 return 'DASH_MATCH';
211 case TokenKind.PREFIX_MATCH: 227 case TokenKind.PREFIX_MATCH:
212 return 'PREFIX_MATCH'; 228 return 'PREFIX_MATCH';
213 case TokenKind.SUFFIX_MATCH: 229 case TokenKind.SUFFIX_MATCH:
214 return 'SUFFIX_MATCH'; 230 return 'SUFFIX_MATCH';
215 case TokenKind.SUBSTRING_MATCH: 231 case TokenKind.SUBSTRING_MATCH:
216 return 'SUBSTRING_MATCH'; 232 return 'SUBSTRING_MATCH';
217 } 233 }
234 return null;
218 } 235 }
219 236
220 String valueToString() { 237 String valueToString() {
221 if (_value != null) { 238 if (_value != null) {
222 if (_value is Identifier) { 239 if (_value is Identifier) {
223 return _value.name; 240 return _value.name;
224 } else { 241 } else {
225 return '"${_value}"'; 242 return '"${_value}"';
226 } 243 }
227 } else { 244 } else {
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 case TokenKind.DIRECTIVE_KEYFRAMES: 582 case TokenKind.DIRECTIVE_KEYFRAMES:
566 case TokenKind.DIRECTIVE_MS_KEYFRAMES: 583 case TokenKind.DIRECTIVE_MS_KEYFRAMES:
567 return '@keyframes'; 584 return '@keyframes';
568 case TokenKind.DIRECTIVE_WEB_KIT_KEYFRAMES: 585 case TokenKind.DIRECTIVE_WEB_KIT_KEYFRAMES:
569 return '@-webkit-keyframes'; 586 return '@-webkit-keyframes';
570 case TokenKind.DIRECTIVE_MOZ_KEYFRAMES: 587 case TokenKind.DIRECTIVE_MOZ_KEYFRAMES:
571 return '@-moz-keyframes'; 588 return '@-moz-keyframes';
572 case TokenKind.DIRECTIVE_O_KEYFRAMES: 589 case TokenKind.DIRECTIVE_O_KEYFRAMES:
573 return '@-o-keyframes'; 590 return '@-o-keyframes';
574 } 591 }
592 return null;
575 } 593 }
576 594
577 KeyFrameDirective clone() { 595 KeyFrameDirective clone() {
578 var cloneBlocks = []; 596 var cloneBlocks = [];
579 for (var block in _blocks) { 597 for (var block in _blocks) {
580 cloneBlocks.add(block.clone()); 598 cloneBlocks.add(block.clone());
581 } 599 }
582 return new KeyFrameDirective(_keyframeName, cloneBlocks, span); 600 return new KeyFrameDirective(_keyframeName, cloneBlocks, span);
583 } 601 }
584 visit(VisitorBase visitor) => visitor.visitKeyFrameDirective(this); 602 visit(VisitorBase visitor) => visitor.visitKeyFrameDirective(this);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 cloneDefinedArgs.add(definedArg.clone()); 687 cloneDefinedArgs.add(definedArg.clone());
670 } 688 }
671 return new MixinDefinition(name, cloneDefinedArgs, varArgs, span); 689 return new MixinDefinition(name, cloneDefinedArgs, varArgs, span);
672 } 690 }
673 691
674 visit(VisitorBase visitor) => visitor.visitMixinDefinition(this); 692 visit(VisitorBase visitor) => visitor.visitMixinDefinition(this);
675 } 693 }
676 694
677 /** Support a Sass @mixin. See http://sass-lang.com for description. */ 695 /** Support a Sass @mixin. See http://sass-lang.com for description. */
678 class MixinRulesetDirective extends MixinDefinition { 696 class MixinRulesetDirective extends MixinDefinition {
679 final List<RuleSet> rulesets; 697 final List rulesets;
680 698
681 MixinRulesetDirective(String name, List<VarDefinitionDirective> args, 699 MixinRulesetDirective(String name, List<VarDefinitionDirective> args,
682 bool varArgs, this.rulesets, SourceSpan span) 700 bool varArgs, this.rulesets, SourceSpan span)
683 : super(name, args, varArgs, span); 701 : super(name, args, varArgs, span);
684 702
685 MixinRulesetDirective clone() { 703 MixinRulesetDirective clone() {
686 var clonedArgs = []; 704 var clonedArgs = [];
687 for (var arg in definedArgs) { 705 for (var arg in definedArgs) {
688 clonedArgs.add(arg.clone()); 706 clonedArgs.add(arg.clone());
689 } 707 }
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 1434
1417 PaddingExpression._merge( 1435 PaddingExpression._merge(
1418 PaddingExpression x, PaddingExpression y, SourceSpan span) 1436 PaddingExpression x, PaddingExpression y, SourceSpan span)
1419 : super(DartStyleExpression.paddingStyle, span, 1437 : super(DartStyleExpression.paddingStyle, span,
1420 new BoxEdge.merge(x.box, y.box)); 1438 new BoxEdge.merge(x.box, y.box));
1421 1439
1422 PaddingExpression clone() => new PaddingExpression(span, 1440 PaddingExpression clone() => new PaddingExpression(span,
1423 top: box.top, right: box.right, bottom: box.bottom, left: box.left); 1441 top: box.top, right: box.right, bottom: box.bottom, left: box.left);
1424 visit(VisitorBase visitor) => visitor.visitPaddingExpression(this); 1442 visit(VisitorBase visitor) => visitor.visitPaddingExpression(this);
1425 } 1443 }
OLDNEW
« no previous file with comments | « packages/csslib/lib/src/tokenkind.dart ('k') | packages/csslib/lib/src/tree_printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698