| 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 library csslib.visitor; | 5 library csslib.visitor; |
| 6 | 6 |
| 7 import 'package:source_span/source_span.dart'; | 7 import 'package:source_span/source_span.dart'; |
| 8 import 'parser.dart'; | 8 import 'parser.dart'; |
| 9 | 9 |
| 10 part 'src/css_printer.dart'; | 10 part 'src/css_printer.dart'; |
| 11 part 'src/tree.dart'; | 11 part 'src/tree.dart'; |
| 12 part 'src/tree_base.dart'; | 12 part 'src/tree_base.dart'; |
| 13 part 'src/tree_printer.dart'; | 13 part 'src/tree_printer.dart'; |
| 14 | 14 |
| 15 abstract class VisitorBase { | 15 abstract class VisitorBase { |
| 16 visitCalcTerm(CalcTerm node); | 16 visitCalcTerm(CalcTerm node); |
| 17 visitCssComment(CssComment node); | 17 visitCssComment(CssComment node); |
| 18 visitCommentDefinition(CommentDefinition node); | 18 visitCommentDefinition(CommentDefinition node); |
| 19 visitStyleSheet(StyleSheet node); | 19 visitStyleSheet(StyleSheet node); |
| 20 visitNoOp(NoOp node); | 20 visitNoOp(NoOp node); |
| 21 visitTopLevelProduction(TopLevelProduction node); | 21 visitTopLevelProduction(TopLevelProduction node); |
| 22 visitDirective(Directive node); | 22 visitDirective(Directive node); |
| 23 visitDocumentDirective(DocumentDirective node); |
| 24 visitSupportsDirective(SupportsDirective node); |
| 25 visitSupportsConditionInParens(SupportsConditionInParens node); |
| 26 visitSupportsNegation(SupportsNegation node); |
| 27 visitSupportsConjunction(SupportsConjunction node); |
| 28 visitSupportsDisjunction(SupportsDisjunction node); |
| 29 visitViewportDirective(ViewportDirective node); |
| 23 visitMediaExpression(MediaExpression node); | 30 visitMediaExpression(MediaExpression node); |
| 24 visitMediaQuery(MediaQuery node); | 31 visitMediaQuery(MediaQuery node); |
| 25 visitMediaDirective(MediaDirective node); | 32 visitMediaDirective(MediaDirective node); |
| 26 visitHostDirective(HostDirective node); | 33 visitHostDirective(HostDirective node); |
| 27 visitPageDirective(PageDirective node); | 34 visitPageDirective(PageDirective node); |
| 28 visitCharsetDirective(CharsetDirective node); | 35 visitCharsetDirective(CharsetDirective node); |
| 29 visitImportDirective(ImportDirective node); | 36 visitImportDirective(ImportDirective node); |
| 30 visitKeyFrameDirective(KeyFrameDirective node); | 37 visitKeyFrameDirective(KeyFrameDirective node); |
| 31 visitKeyFrameBlock(KeyFrameBlock node); | 38 visitKeyFrameBlock(KeyFrameBlock node); |
| 32 visitFontFaceDirective(FontFaceDirective node); | 39 visitFontFaceDirective(FontFaceDirective node); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 visitMediaExpression(MediaExpression node) { | 152 visitMediaExpression(MediaExpression node) { |
| 146 visitExpressions(node.exprs); | 153 visitExpressions(node.exprs); |
| 147 } | 154 } |
| 148 | 155 |
| 149 visitMediaQuery(MediaQuery node) { | 156 visitMediaQuery(MediaQuery node) { |
| 150 for (var mediaExpr in node.expressions) { | 157 for (var mediaExpr in node.expressions) { |
| 151 visitMediaExpression(mediaExpr); | 158 visitMediaExpression(mediaExpr); |
| 152 } | 159 } |
| 153 } | 160 } |
| 154 | 161 |
| 162 visitDocumentDirective(DocumentDirective node) { |
| 163 _visitNodeList(node.functions); |
| 164 _visitNodeList(node.groupRuleBody); |
| 165 } |
| 166 |
| 167 visitSupportsDirective(SupportsDirective node) { |
| 168 node.condition.visit(this); |
| 169 _visitNodeList(node.groupRuleBody); |
| 170 } |
| 171 |
| 172 visitSupportsConditionInParens(SupportsConditionInParens node) { |
| 173 node.condition.visit(this); |
| 174 } |
| 175 |
| 176 visitSupportsNegation(SupportsNegation node) { |
| 177 node.condition.visit(this); |
| 178 } |
| 179 |
| 180 visitSupportsConjunction(SupportsConjunction node) { |
| 181 _visitNodeList(node.conditions); |
| 182 } |
| 183 |
| 184 visitSupportsDisjunction(SupportsDisjunction node) { |
| 185 _visitNodeList(node.conditions); |
| 186 } |
| 187 |
| 188 visitViewportDirective(ViewportDirective node) { |
| 189 node.declarations.visit(this); |
| 190 } |
| 191 |
| 155 visitMediaDirective(MediaDirective node) { | 192 visitMediaDirective(MediaDirective node) { |
| 156 for (var mediaQuery in node.mediaQueries) { | 193 for (var mediaQuery in node.mediaQueries) { |
| 157 visitMediaQuery(mediaQuery); | 194 visitMediaQuery(mediaQuery); |
| 158 } | 195 } |
| 159 for (var ruleset in node.rulesets) { | 196 for (var ruleset in node.rulesets) { |
| 160 visitRuleSet(ruleset); | 197 visitRuleSet(ruleset); |
| 161 } | 198 } |
| 162 } | 199 } |
| 163 | 200 |
| 164 visitHostDirective(HostDirective node) { | 201 visitHostDirective(HostDirective node) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 332 |
| 296 visitPseudoElementSelector(PseudoElementSelector node) => | 333 visitPseudoElementSelector(PseudoElementSelector node) => |
| 297 visitSimpleSelector(node); | 334 visitSimpleSelector(node); |
| 298 | 335 |
| 299 visitPseudoClassFunctionSelector(PseudoClassFunctionSelector node) => | 336 visitPseudoClassFunctionSelector(PseudoClassFunctionSelector node) => |
| 300 visitSimpleSelector(node); | 337 visitSimpleSelector(node); |
| 301 | 338 |
| 302 visitPseudoElementFunctionSelector(PseudoElementFunctionSelector node) => | 339 visitPseudoElementFunctionSelector(PseudoElementFunctionSelector node) => |
| 303 visitSimpleSelector(node); | 340 visitSimpleSelector(node); |
| 304 | 341 |
| 305 visitNegationSelector(NegationSelector node) => | 342 visitNegationSelector(NegationSelector node) => visitSimpleSelector(node); |
| 306 visitSimpleSelector(node); | |
| 307 | 343 |
| 308 visitSelectorExpression(SelectorExpression node) { | 344 visitSelectorExpression(SelectorExpression node) { |
| 309 _visitNodeList(node.expressions); | 345 _visitNodeList(node.expressions); |
| 310 } | 346 } |
| 311 | 347 |
| 312 visitUnicodeRangeTerm(UnicodeRangeTerm node) {} | 348 visitUnicodeRangeTerm(UnicodeRangeTerm node) {} |
| 313 | 349 |
| 314 visitLiteralTerm(LiteralTerm node) {} | 350 visitLiteralTerm(LiteralTerm node) {} |
| 315 | 351 |
| 316 visitHexColorTerm(HexColorTerm node) {} | 352 visitHexColorTerm(HexColorTerm node) {} |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 visitPaddingExpression(PaddingExpression node) { | 488 visitPaddingExpression(PaddingExpression node) { |
| 453 // TODO(terry): TBD | 489 // TODO(terry): TBD |
| 454 throw new UnimplementedError(); | 490 throw new UnimplementedError(); |
| 455 } | 491 } |
| 456 | 492 |
| 457 visitWidthExpression(WidthExpression node) { | 493 visitWidthExpression(WidthExpression node) { |
| 458 // TODO(terry): TBD | 494 // TODO(terry): TBD |
| 459 throw new UnimplementedError(); | 495 throw new UnimplementedError(); |
| 460 } | 496 } |
| 461 } | 497 } |
| OLD | NEW |