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

Side by Side Diff: utils/css/tree.dart

Issue 10915231: Changed interfaces to abstract classes in utils. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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/css/tokenizer_base.dart ('k') | utils/lib/file_system.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) 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 case TokenKind.DASH_MATCH: 217 case TokenKind.DASH_MATCH:
218 return 'DASH_MATCH'; 218 return 'DASH_MATCH';
219 case TokenKind.PREFIX_MATCH: 219 case TokenKind.PREFIX_MATCH:
220 return 'PREFIX_MATCH'; 220 return 'PREFIX_MATCH';
221 case TokenKind.SUFFIX_MATCH: 221 case TokenKind.SUFFIX_MATCH:
222 return 'SUFFIX_MATCH'; 222 return 'SUFFIX_MATCH';
223 case TokenKind.SUBSTRING_MATCH: 223 case TokenKind.SUBSTRING_MATCH:
224 return 'SUBSTRING_MATCH'; 224 return 'SUBSTRING_MATCH';
225 } 225 }
226 } 226 }
227 227
228 String valueToString() { 228 String valueToString() {
229 if (_value is Identifier) { 229 if (_value is Identifier) {
230 return _value.name; 230 return _value.name;
231 } else { 231 } else {
232 return '"${_value}"'; 232 return '"${_value}"';
233 } 233 }
234 } 234 }
235 235
236 visit(TreeVisitor visitor) => visitor.visitAttributeSelector(this); 236 visit(TreeVisitor visitor) => visitor.visitAttributeSelector(this);
237 237
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. */
310 String toDebugString() { 310 String toDebugString() {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 693
694 visit(TreeVisitor visitor) => visitor.visitFractionTerm(this); 694 visit(TreeVisitor visitor) => visitor.visitFractionTerm(this);
695 695
696 String toString() => '${text}fr'; 696 String toString() => '${text}fr';
697 } 697 }
698 698
699 class UriTerm extends LiteralTerm { 699 class UriTerm extends LiteralTerm {
700 UriTerm(String value, SourceSpan span) : super(value, value, span); 700 UriTerm(String value, SourceSpan span) : super(value, value, span);
701 701
702 visit(TreeVisitor visitor) => visitor.visitUriTerm(this); 702 visit(TreeVisitor visitor) => visitor.visitUriTerm(this);
703 703
704 String toString() => 'url(${text})'; 704 String toString() => 'url(${text})';
705 } 705 }
706 706
707 class HexColorTerm extends LiteralTerm { 707 class HexColorTerm extends LiteralTerm {
708 HexColorTerm(var value, String t, SourceSpan span) : 708 HexColorTerm(var value, String t, SourceSpan span) :
709 super(value, t, span); 709 super(value, t, span);
710 710
711 visit(TreeVisitor visitor) => visitor.visitHexColorTerm(this); 711 visit(TreeVisitor visitor) => visitor.visitHexColorTerm(this);
712 712
713 String toString() => '#${text}'; 713 String toString() => '#${text}';
714 } 714 }
715 715
716 class FunctionTerm extends LiteralTerm { 716 class FunctionTerm extends LiteralTerm {
717 Expressions _params; 717 Expressions _params;
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);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 809
810 class UnaryExpression extends Expression { 810 class UnaryExpression extends Expression {
811 Token op; 811 Token op;
812 Expression self; 812 Expression self;
813 813
814 UnaryExpression(this.op, this.self, SourceSpan span): super(span); 814 UnaryExpression(this.op, this.self, SourceSpan span): super(span);
815 815
816 visit(TreeVisitor visitor) => visitor.visitUnaryExpression(this); 816 visit(TreeVisitor visitor) => visitor.visitUnaryExpression(this);
817 } 817 }
818 818
819 interface TreeVisitor { 819 abstract class TreeVisitor {
820 void visitCssComment(CssComment node); 820 void visitCssComment(CssComment node);
821 void visitCommentDefinition(CommentDefinition node); 821 void visitCommentDefinition(CommentDefinition node);
822 void visitStylesheet(Stylesheet node); 822 void visitStylesheet(Stylesheet node);
823 void visitTopLevelProduction(TopLevelProduction node); 823 void visitTopLevelProduction(TopLevelProduction node);
824 void visitDirective(Directive node); 824 void visitDirective(Directive node);
825 void visitMediaDirective(MediaDirective node); 825 void visitMediaDirective(MediaDirective node);
826 void visitPageDirective(PageDirective node); 826 void visitPageDirective(PageDirective node);
827 void visitImportDirective(ImportDirective node); 827 void visitImportDirective(ImportDirective node);
828 void visitKeyFrameDirective(KeyFrameDirective node); 828 void visitKeyFrameDirective(KeyFrameDirective node);
829 void visitKeyFrameBlock(KeyFrameBlock node); 829 void visitKeyFrameBlock(KeyFrameBlock node);
830 void visitFontFaceDirective(FontFaceDirective node); 830 void visitFontFaceDirective(FontFaceDirective node);
831 void visitIncludeDirective(IncludeDirective node); 831 void visitIncludeDirective(IncludeDirective node);
832 void visitStyletDirective(StyletDirective node); 832 void visitStyletDirective(StyletDirective node);
833 833
834 void visitRuleSet(RuleSet node); 834 void visitRuleSet(RuleSet node);
835 void visitDeclarationGroup(DeclarationGroup node); 835 void visitDeclarationGroup(DeclarationGroup node);
836 void visitDeclaration(Declaration node); 836 void visitDeclaration(Declaration node);
837 void visitSelectorGroup(SelectorGroup node); 837 void visitSelectorGroup(SelectorGroup node);
838 void visitSelector(Selector node); 838 void visitSelector(Selector node);
839 void visitSimpleSelectorSequence(SimpleSelectorSequence node); 839 void visitSimpleSelectorSequence(SimpleSelectorSequence node);
840 void visitSimpleSelector(SimpleSelector node); 840 void visitSimpleSelector(SimpleSelector node);
841 void visitElementSelector(ElementSelector node); 841 void visitElementSelector(ElementSelector node);
842 void visitNamespaceSelector(NamespaceSelector node); 842 void visitNamespaceSelector(NamespaceSelector node);
843 void visitAttributeSelector(AttributeSelector node); 843 void visitAttributeSelector(AttributeSelector node);
844 void visitIdSelector(IdSelector node); 844 void visitIdSelector(IdSelector node);
845 void visitClassSelector(ClassSelector node); 845 void visitClassSelector(ClassSelector node);
846 void visitPseudoClassSelector(PseudoClassSelector node); 846 void visitPseudoClassSelector(PseudoClassSelector node);
847 void visitPseudoElementSelector(PseudoElementSelector node); 847 void visitPseudoElementSelector(PseudoElementSelector node);
848 void visitNotSelector(NotSelector node); 848 void visitNotSelector(NotSelector node);
849 849
850 void visitLiteralTerm(LiteralTerm node); 850 void visitLiteralTerm(LiteralTerm node);
851 void visitHexColorTerm(HexColorTerm node); 851 void visitHexColorTerm(HexColorTerm node);
852 void visitNumberTerm(NumberTerm node); 852 void visitNumberTerm(NumberTerm node);
853 void visitUnitTerm(UnitTerm node); 853 void visitUnitTerm(UnitTerm node);
854 void visitLengthTerm(LengthTerm node); 854 void visitLengthTerm(LengthTerm node);
855 void visitPercentageTerm(PercentageTerm node); 855 void visitPercentageTerm(PercentageTerm node);
856 void visitEmTerm(EmTerm node); 856 void visitEmTerm(EmTerm node);
857 void visitExTerm(ExTerm node); 857 void visitExTerm(ExTerm node);
858 void visitAngleTerm(AngleTerm node); 858 void visitAngleTerm(AngleTerm node);
859 void visitTimeTerm(TimeTerm node); 859 void visitTimeTerm(TimeTerm node);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 output.depth++; 939 output.depth++;
940 output.writeValue('name', node._name); 940 output.writeValue('name', node._name);
941 output.writeNodeList('blocks', node._blocks); 941 output.writeNodeList('blocks', node._blocks);
942 output.depth--; 942 output.depth--;
943 } 943 }
944 944
945 void visitKeyFrameBlock(KeyFrameBlock node) { 945 void visitKeyFrameBlock(KeyFrameBlock node) {
946 output.heading('KeyFrameBlock', node.span); 946 output.heading('KeyFrameBlock', node.span);
947 output.depth++; 947 output.depth++;
948 visitExpressions(node._blockSelectors); 948 visitExpressions(node._blockSelectors);
949 visitDeclarationGroup(node._declarations); 949 visitDeclarationGroup(node._declarations);
950 output.depth--; 950 output.depth--;
951 } 951 }
952 952
953 void visitFontFaceDirective(FontFaceDirective node) { 953 void visitFontFaceDirective(FontFaceDirective node) {
954 // TODO(terry): To Be Implemented 954 // TODO(terry): To Be Implemented
955 } 955 }
956 956
957 void visitIncludeDirective(IncludeDirective node) { 957 void visitIncludeDirective(IncludeDirective node) {
958 output.heading('IncludeDirective', node.span); 958 output.heading('IncludeDirective', node.span);
959 output.writeValue('include', node._include); 959 output.writeValue('include', node._include);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 output.heading('LengthTerm', node.span); 1168 output.heading('LengthTerm', node.span);
1169 visitUnitTerm(node); 1169 visitUnitTerm(node);
1170 } 1170 }
1171 1171
1172 void visitPercentageTerm(PercentageTerm node) { 1172 void visitPercentageTerm(PercentageTerm node) {
1173 output.heading('PercentageTerm', node.span); 1173 output.heading('PercentageTerm', node.span);
1174 output.depth++; 1174 output.depth++;
1175 visitLiteralTerm(node); 1175 visitLiteralTerm(node);
1176 output.depth--; 1176 output.depth--;
1177 } 1177 }
1178 1178
1179 void visitEmTerm(EmTerm node) { 1179 void visitEmTerm(EmTerm node) {
1180 output.heading('EmTerm', node.span); 1180 output.heading('EmTerm', node.span);
1181 output.depth++; 1181 output.depth++;
1182 visitLiteralTerm(node); 1182 visitLiteralTerm(node);
1183 output.depth--; 1183 output.depth--;
1184 } 1184 }
1185 1185
1186 void visitExTerm(ExTerm node) { 1186 void visitExTerm(ExTerm node) {
1187 output.heading('ExTerm', node.span); 1187 output.heading('ExTerm', node.span);
1188 output.depth++; 1188 output.depth++;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « utils/css/tokenizer_base.dart ('k') | utils/lib/file_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698