| 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 void visitCssComment(CssComment node); | 16 visitCalcTerm(CalcTerm node); |
| 17 void visitCommentDefinition(CommentDefinition node); | 17 visitCssComment(CssComment node); |
| 18 void visitStyleSheet(StyleSheet node); | 18 visitCommentDefinition(CommentDefinition node); |
| 19 void visitNoOp(NoOp node); | 19 visitStyleSheet(StyleSheet node); |
| 20 void visitTopLevelProduction(TopLevelProduction node); | 20 visitNoOp(NoOp node); |
| 21 void visitDirective(Directive node); | 21 visitTopLevelProduction(TopLevelProduction node); |
| 22 void visitMediaExpression(MediaExpression node); | 22 visitDirective(Directive node); |
| 23 void visitMediaQuery(MediaQuery node); | 23 visitMediaExpression(MediaExpression node); |
| 24 void visitMediaDirective(MediaDirective node); | 24 visitMediaQuery(MediaQuery node); |
| 25 void visitHostDirective(HostDirective node); | 25 visitMediaDirective(MediaDirective node); |
| 26 void visitPageDirective(PageDirective node); | 26 visitHostDirective(HostDirective node); |
| 27 void visitCharsetDirective(CharsetDirective node); | 27 visitPageDirective(PageDirective node); |
| 28 void visitImportDirective(ImportDirective node); | 28 visitCharsetDirective(CharsetDirective node); |
| 29 void visitKeyFrameDirective(KeyFrameDirective node); | 29 visitImportDirective(ImportDirective node); |
| 30 void visitKeyFrameBlock(KeyFrameBlock node); | 30 visitKeyFrameDirective(KeyFrameDirective node); |
| 31 void visitFontFaceDirective(FontFaceDirective node); | 31 visitKeyFrameBlock(KeyFrameBlock node); |
| 32 void visitStyletDirective(StyletDirective node); | 32 visitFontFaceDirective(FontFaceDirective node); |
| 33 void visitNamespaceDirective(NamespaceDirective node); | 33 visitStyletDirective(StyletDirective node); |
| 34 void visitVarDefinitionDirective(VarDefinitionDirective node); | 34 visitNamespaceDirective(NamespaceDirective node); |
| 35 void visitMixinDefinition(MixinDefinition node); | 35 visitVarDefinitionDirective(VarDefinitionDirective node); |
| 36 void visitMixinRulesetDirective(MixinRulesetDirective node); | 36 visitMixinDefinition(MixinDefinition node); |
| 37 void visitMixinDeclarationDirective(MixinDeclarationDirective node); | 37 visitMixinRulesetDirective(MixinRulesetDirective node); |
| 38 void visitIncludeDirective(IncludeDirective node); | 38 visitMixinDeclarationDirective(MixinDeclarationDirective node); |
| 39 void visitContentDirective(ContentDirective node); | 39 visitIncludeDirective(IncludeDirective node); |
| 40 visitContentDirective(ContentDirective node); |
| 40 | 41 |
| 41 void visitRuleSet(RuleSet node); | 42 visitRuleSet(RuleSet node); |
| 42 void visitDeclarationGroup(DeclarationGroup node); | 43 visitDeclarationGroup(DeclarationGroup node); |
| 43 void visitMarginGroup(MarginGroup node); | 44 visitMarginGroup(MarginGroup node); |
| 44 void visitDeclaration(Declaration node); | 45 visitDeclaration(Declaration node); |
| 45 void visitVarDefinition(VarDefinition node); | 46 visitVarDefinition(VarDefinition node); |
| 46 void visitIncludeMixinAtDeclaration(IncludeMixinAtDeclaration node); | 47 visitIncludeMixinAtDeclaration(IncludeMixinAtDeclaration node); |
| 47 void visitExtendDeclaration(ExtendDeclaration node); | 48 visitExtendDeclaration(ExtendDeclaration node); |
| 48 void visitSelectorGroup(SelectorGroup node); | 49 visitSelectorGroup(SelectorGroup node); |
| 49 void visitSelector(Selector node); | 50 visitSelector(Selector node); |
| 50 void visitSimpleSelectorSequence(SimpleSelectorSequence node); | 51 visitSimpleSelectorSequence(SimpleSelectorSequence node); |
| 51 void visitSimpleSelector(SimpleSelector node); | 52 visitSimpleSelector(SimpleSelector node); |
| 52 void visitElementSelector(ElementSelector node); | 53 visitElementSelector(ElementSelector node); |
| 53 void visitNamespaceSelector(NamespaceSelector node); | 54 visitNamespaceSelector(NamespaceSelector node); |
| 54 void visitAttributeSelector(AttributeSelector node); | 55 visitAttributeSelector(AttributeSelector node); |
| 55 void visitIdSelector(IdSelector node); | 56 visitIdSelector(IdSelector node); |
| 56 void visitClassSelector(ClassSelector node); | 57 visitClassSelector(ClassSelector node); |
| 57 void visitPseudoClassSelector(PseudoClassSelector node); | 58 visitPseudoClassSelector(PseudoClassSelector node); |
| 58 void visitPseudoElementSelector(PseudoElementSelector node); | 59 visitPseudoElementSelector(PseudoElementSelector node); |
| 59 void visitPseudoClassFunctionSelector(PseudoClassFunctionSelector node); | 60 visitPseudoClassFunctionSelector(PseudoClassFunctionSelector node); |
| 60 void visitPseudoElementFunctionSelector(PseudoElementFunctionSelector node); | 61 visitPseudoElementFunctionSelector(PseudoElementFunctionSelector node); |
| 61 void visitNegationSelector(NegationSelector node); | 62 visitNegationSelector(NegationSelector node); |
| 62 void visitSelectorExpression(SelectorExpression node); | 63 visitSelectorExpression(SelectorExpression node); |
| 63 | 64 |
| 64 void visitUnicodeRangeTerm(UnicodeRangeTerm node); | 65 visitUnicodeRangeTerm(UnicodeRangeTerm node); |
| 65 void visitLiteralTerm(LiteralTerm node); | 66 visitLiteralTerm(LiteralTerm node); |
| 66 void visitHexColorTerm(HexColorTerm node); | 67 visitHexColorTerm(HexColorTerm node); |
| 67 void visitNumberTerm(NumberTerm node); | 68 visitNumberTerm(NumberTerm node); |
| 68 void visitUnitTerm(UnitTerm node); | 69 visitUnitTerm(UnitTerm node); |
| 69 void visitLengthTerm(LengthTerm node); | 70 visitLengthTerm(LengthTerm node); |
| 70 void visitPercentageTerm(PercentageTerm node); | 71 visitPercentageTerm(PercentageTerm node); |
| 71 void visitEmTerm(EmTerm node); | 72 visitEmTerm(EmTerm node); |
| 72 void visitExTerm(ExTerm node); | 73 visitExTerm(ExTerm node); |
| 73 void visitAngleTerm(AngleTerm node); | 74 visitAngleTerm(AngleTerm node); |
| 74 void visitTimeTerm(TimeTerm node); | 75 visitTimeTerm(TimeTerm node); |
| 75 void visitFreqTerm(FreqTerm node); | 76 visitFreqTerm(FreqTerm node); |
| 76 void visitFractionTerm(FractionTerm node); | 77 visitFractionTerm(FractionTerm node); |
| 77 void visitUriTerm(UriTerm node); | 78 visitUriTerm(UriTerm node); |
| 78 void visitResolutionTerm(ResolutionTerm node); | 79 visitResolutionTerm(ResolutionTerm node); |
| 79 void visitChTerm(ChTerm node); | 80 visitChTerm(ChTerm node); |
| 80 void visitRemTerm(RemTerm node); | 81 visitRemTerm(RemTerm node); |
| 81 void visitViewportTerm(ViewportTerm node); | 82 visitViewportTerm(ViewportTerm node); |
| 82 void visitFunctionTerm(FunctionTerm node); | 83 visitFunctionTerm(FunctionTerm node); |
| 83 void visitGroupTerm(GroupTerm node); | 84 visitGroupTerm(GroupTerm node); |
| 84 void visitItemTerm(ItemTerm node); | 85 visitItemTerm(ItemTerm node); |
| 85 void visitIE8Term(IE8Term node); | 86 visitIE8Term(IE8Term node); |
| 86 void visitOperatorSlash(OperatorSlash node); | 87 visitOperatorSlash(OperatorSlash node); |
| 87 void visitOperatorComma(OperatorComma node); | 88 visitOperatorComma(OperatorComma node); |
| 88 void visitOperatorPlus(OperatorPlus node); | 89 visitOperatorPlus(OperatorPlus node); |
| 89 void visitOperatorMinus(OperatorMinus node); | 90 visitOperatorMinus(OperatorMinus node); |
| 90 void visitVarUsage(VarUsage node); | 91 visitVarUsage(VarUsage node); |
| 91 | 92 |
| 92 void visitExpressions(Expressions node); | 93 visitExpressions(Expressions node); |
| 93 void visitBinaryExpression(BinaryExpression node); | 94 visitBinaryExpression(BinaryExpression node); |
| 94 void visitUnaryExpression(UnaryExpression node); | 95 visitUnaryExpression(UnaryExpression node); |
| 95 | 96 |
| 96 void visitIdentifier(Identifier node); | 97 visitIdentifier(Identifier node); |
| 97 void visitWildcard(Wildcard node); | 98 visitWildcard(Wildcard node); |
| 98 void visitThisOperator(ThisOperator node); | 99 visitThisOperator(ThisOperator node); |
| 99 void visitNegation(Negation node); | 100 visitNegation(Negation node); |
| 100 | 101 |
| 101 void visitDartStyleExpression(DartStyleExpression node); | 102 visitDartStyleExpression(DartStyleExpression node); |
| 102 void visitFontExpression(FontExpression node); | 103 visitFontExpression(FontExpression node); |
| 103 void visitBoxExpression(BoxExpression node); | 104 visitBoxExpression(BoxExpression node); |
| 104 void visitMarginExpression(MarginExpression node); | 105 visitMarginExpression(MarginExpression node); |
| 105 void visitBorderExpression(BorderExpression node); | 106 visitBorderExpression(BorderExpression node); |
| 106 void visitHeightExpression(HeightExpression node); | 107 visitHeightExpression(HeightExpression node); |
| 107 void visitPaddingExpression(PaddingExpression node); | 108 visitPaddingExpression(PaddingExpression node); |
| 108 void visitWidthExpression(WidthExpression node); | 109 visitWidthExpression(WidthExpression node); |
| 109 } | 110 } |
| 110 | 111 |
| 111 /** Base vistor class for the style sheet AST. */ | 112 /** Base vistor class for the style sheet AST. */ |
| 112 class Visitor implements VisitorBase { | 113 class Visitor implements VisitorBase { |
| 113 /** Helper function to walk a list of nodes. */ | 114 /** Helper function to walk a list of nodes. */ |
| 114 void _visitNodeList(List<TreeNode> list) { | 115 void _visitNodeList(List<TreeNode> list) { |
| 115 // Don't use iterable otherwise the list can't grow while using Visitor. | 116 // Don't use iterable otherwise the list can't grow while using Visitor. |
| 116 // It certainly can't have items deleted before the index being iterated | 117 // It certainly can't have items deleted before the index being iterated |
| 117 // but items could be added after the index. | 118 // but items could be added after the index. |
| 118 for (var index = 0; index < list.length; index++) { | 119 for (var index = 0; index < list.length; index++) { |
| 119 list[index].visit(this); | 120 list[index].visit(this); |
| 120 } | 121 } |
| 121 } | 122 } |
| 122 | 123 |
| 123 void visitTree(StyleSheet tree) => visitStyleSheet(tree); | 124 visitTree(StyleSheet tree) => visitStyleSheet(tree); |
| 124 | 125 |
| 125 void visitStyleSheet(StyleSheet ss) { | 126 visitStyleSheet(StyleSheet ss) { |
| 126 _visitNodeList(ss.topLevels); | 127 _visitNodeList(ss.topLevels); |
| 127 } | 128 } |
| 128 | 129 |
| 129 void visitNoOp(NoOp node) {} | 130 visitNoOp(NoOp node) {} |
| 130 | 131 |
| 131 void visitTopLevelProduction(TopLevelProduction node) {} | 132 visitTopLevelProduction(TopLevelProduction node) {} |
| 132 | 133 |
| 133 void visitDirective(Directive node) {} | 134 visitDirective(Directive node) {} |
| 134 | 135 |
| 135 void visitCssComment(CssComment node) {} | 136 visitCalcTerm(CalcTerm node) { |
| 137 visitLiteralTerm(node); |
| 138 visitLiteralTerm(node.expr); |
| 139 } |
| 136 | 140 |
| 137 void visitCommentDefinition(CommentDefinition node) {} | 141 visitCssComment(CssComment node) {} |
| 138 | 142 |
| 139 void visitMediaExpression(MediaExpression node) { | 143 visitCommentDefinition(CommentDefinition node) {} |
| 144 |
| 145 visitMediaExpression(MediaExpression node) { |
| 140 visitExpressions(node.exprs); | 146 visitExpressions(node.exprs); |
| 141 } | 147 } |
| 142 | 148 |
| 143 void visitMediaQuery(MediaQuery node) { | 149 visitMediaQuery(MediaQuery node) { |
| 144 for (var mediaExpr in node.expressions) { | 150 for (var mediaExpr in node.expressions) { |
| 145 visitMediaExpression(mediaExpr); | 151 visitMediaExpression(mediaExpr); |
| 146 } | 152 } |
| 147 } | 153 } |
| 148 | 154 |
| 149 void visitMediaDirective(MediaDirective node) { | 155 visitMediaDirective(MediaDirective node) { |
| 150 for (var mediaQuery in node.mediaQueries) { | 156 for (var mediaQuery in node.mediaQueries) { |
| 151 visitMediaQuery(mediaQuery); | 157 visitMediaQuery(mediaQuery); |
| 152 } | 158 } |
| 153 for (var ruleset in node.rulesets) { | 159 for (var ruleset in node.rulesets) { |
| 154 visitRuleSet(ruleset); | 160 visitRuleSet(ruleset); |
| 155 } | 161 } |
| 156 } | 162 } |
| 157 | 163 |
| 158 void visitHostDirective(HostDirective node) { | 164 visitHostDirective(HostDirective node) { |
| 159 for (var ruleset in node.rulesets) { | 165 for (var ruleset in node.rulesets) { |
| 160 visitRuleSet(ruleset); | 166 visitRuleSet(ruleset); |
| 161 } | 167 } |
| 162 } | 168 } |
| 163 | 169 |
| 164 void visitPageDirective(PageDirective node) { | 170 visitPageDirective(PageDirective node) { |
| 165 for (var declGroup in node._declsMargin) { | 171 for (var declGroup in node._declsMargin) { |
| 166 if (declGroup is MarginGroup) { | 172 if (declGroup is MarginGroup) { |
| 167 visitMarginGroup(declGroup); | 173 visitMarginGroup(declGroup); |
| 168 } else { | 174 } else { |
| 169 visitDeclarationGroup(declGroup); | 175 visitDeclarationGroup(declGroup); |
| 170 } | 176 } |
| 171 } | 177 } |
| 172 } | 178 } |
| 173 | 179 |
| 174 void visitCharsetDirective(CharsetDirective node) {} | 180 visitCharsetDirective(CharsetDirective node) {} |
| 175 | 181 |
| 176 void visitImportDirective(ImportDirective node) { | 182 visitImportDirective(ImportDirective node) { |
| 177 for (var mediaQuery in node.mediaQueries) { | 183 for (var mediaQuery in node.mediaQueries) { |
| 178 visitMediaQuery(mediaQuery); | 184 visitMediaQuery(mediaQuery); |
| 179 } | 185 } |
| 180 } | 186 } |
| 181 | 187 |
| 182 void visitKeyFrameDirective(KeyFrameDirective node) { | 188 visitKeyFrameDirective(KeyFrameDirective node) { |
| 183 visitIdentifier(node.name); | 189 visitIdentifier(node.name); |
| 184 _visitNodeList(node._blocks); | 190 _visitNodeList(node._blocks); |
| 185 } | 191 } |
| 186 | 192 |
| 187 void visitKeyFrameBlock(KeyFrameBlock node) { | 193 visitKeyFrameBlock(KeyFrameBlock node) { |
| 188 visitExpressions(node._blockSelectors); | 194 visitExpressions(node._blockSelectors); |
| 189 visitDeclarationGroup(node._declarations); | 195 visitDeclarationGroup(node._declarations); |
| 190 } | 196 } |
| 191 | 197 |
| 192 void visitFontFaceDirective(FontFaceDirective node) { | 198 visitFontFaceDirective(FontFaceDirective node) { |
| 193 visitDeclarationGroup(node._declarations); | 199 visitDeclarationGroup(node._declarations); |
| 194 } | 200 } |
| 195 | 201 |
| 196 void visitStyletDirective(StyletDirective node) { | 202 visitStyletDirective(StyletDirective node) { |
| 197 _visitNodeList(node.rulesets); | 203 _visitNodeList(node.rulesets); |
| 198 } | 204 } |
| 199 | 205 |
| 200 void visitNamespaceDirective(NamespaceDirective node) {} | 206 visitNamespaceDirective(NamespaceDirective node) {} |
| 201 | 207 |
| 202 void visitVarDefinitionDirective(VarDefinitionDirective node) { | 208 visitVarDefinitionDirective(VarDefinitionDirective node) { |
| 203 visitVarDefinition(node.def); | 209 visitVarDefinition(node.def); |
| 204 } | 210 } |
| 205 | 211 |
| 206 void visitMixinRulesetDirective(MixinRulesetDirective node) { | 212 visitMixinRulesetDirective(MixinRulesetDirective node) { |
| 207 _visitNodeList(node.rulesets); | 213 _visitNodeList(node.rulesets); |
| 208 } | 214 } |
| 209 | 215 |
| 210 void visitMixinDefinition(MixinDefinition node) {} | 216 visitMixinDefinition(MixinDefinition node) {} |
| 211 | 217 |
| 212 void visitMixinDeclarationDirective(MixinDeclarationDirective node) { | 218 visitMixinDeclarationDirective(MixinDeclarationDirective node) { |
| 213 visitDeclarationGroup(node.declarations); | 219 visitDeclarationGroup(node.declarations); |
| 214 } | 220 } |
| 215 | 221 |
| 216 void visitIncludeDirective(IncludeDirective node) { | 222 visitIncludeDirective(IncludeDirective node) { |
| 217 for (var index = 0; index < node.args.length; index++) { | 223 for (var index = 0; index < node.args.length; index++) { |
| 218 var param = node.args[index]; | 224 var param = node.args[index]; |
| 219 _visitNodeList(param); | 225 _visitNodeList(param); |
| 220 } | 226 } |
| 221 } | 227 } |
| 222 | 228 |
| 223 void visitContentDirective(ContentDirective node) { | 229 visitContentDirective(ContentDirective node) { |
| 224 // TODO(terry): TBD | 230 // TODO(terry): TBD |
| 225 } | 231 } |
| 226 | 232 |
| 227 void visitRuleSet(RuleSet node) { | 233 visitRuleSet(RuleSet node) { |
| 228 visitSelectorGroup(node._selectorGroup); | 234 visitSelectorGroup(node._selectorGroup); |
| 229 visitDeclarationGroup(node._declarationGroup); | 235 visitDeclarationGroup(node._declarationGroup); |
| 230 } | 236 } |
| 231 | 237 |
| 232 void visitDeclarationGroup(DeclarationGroup node) { | 238 visitDeclarationGroup(DeclarationGroup node) { |
| 233 _visitNodeList(node.declarations); | 239 _visitNodeList(node.declarations); |
| 234 } | 240 } |
| 235 | 241 |
| 236 void visitMarginGroup(MarginGroup node) => visitDeclarationGroup(node); | 242 visitMarginGroup(MarginGroup node) => visitDeclarationGroup(node); |
| 237 | 243 |
| 238 void visitDeclaration(Declaration node) { | 244 visitDeclaration(Declaration node) { |
| 239 visitIdentifier(node._property); | 245 visitIdentifier(node._property); |
| 240 if (node._expression != null) node._expression.visit(this); | 246 if (node._expression != null) node._expression.visit(this); |
| 241 } | 247 } |
| 242 | 248 |
| 243 void visitVarDefinition(VarDefinition node) { | 249 visitVarDefinition(VarDefinition node) { |
| 244 visitIdentifier(node._property); | 250 visitIdentifier(node._property); |
| 245 if (node._expression != null) node._expression.visit(this); | 251 if (node._expression != null) node._expression.visit(this); |
| 246 } | 252 } |
| 247 | 253 |
| 248 void visitIncludeMixinAtDeclaration(IncludeMixinAtDeclaration node) { | 254 visitIncludeMixinAtDeclaration(IncludeMixinAtDeclaration node) { |
| 249 visitIncludeDirective(node.include); | 255 visitIncludeDirective(node.include); |
| 250 } | 256 } |
| 251 | 257 |
| 252 void visitExtendDeclaration(ExtendDeclaration node) { | 258 visitExtendDeclaration(ExtendDeclaration node) { |
| 253 _visitNodeList(node.selectors); | 259 _visitNodeList(node.selectors); |
| 254 } | 260 } |
| 255 | 261 |
| 256 void visitSelectorGroup(SelectorGroup node) { | 262 visitSelectorGroup(SelectorGroup node) { |
| 257 _visitNodeList(node.selectors); | 263 _visitNodeList(node.selectors); |
| 258 } | 264 } |
| 259 | 265 |
| 260 void visitSelector(Selector node) { | 266 visitSelector(Selector node) { |
| 261 _visitNodeList(node.simpleSelectorSequences); | 267 _visitNodeList(node.simpleSelectorSequences); |
| 262 } | 268 } |
| 263 | 269 |
| 264 void visitSimpleSelectorSequence(SimpleSelectorSequence node) { | 270 visitSimpleSelectorSequence(SimpleSelectorSequence node) { |
| 265 node.simpleSelector.visit(this); | 271 node.simpleSelector.visit(this); |
| 266 } | 272 } |
| 267 | 273 |
| 268 void visitSimpleSelector(SimpleSelector node) => node._name.visit(this); | 274 visitSimpleSelector(SimpleSelector node) => node._name.visit(this); |
| 269 | 275 |
| 270 void visitNamespaceSelector(NamespaceSelector node) { | 276 visitNamespaceSelector(NamespaceSelector node) { |
| 271 if (node._namespace != null) node._namespace.visit(this); | 277 if (node._namespace != null) node._namespace.visit(this); |
| 272 if (node.nameAsSimpleSelector != null) { | 278 if (node.nameAsSimpleSelector != null) { |
| 273 node.nameAsSimpleSelector.visit(this); | 279 node.nameAsSimpleSelector.visit(this); |
| 274 } | 280 } |
| 275 } | 281 } |
| 276 | 282 |
| 277 void visitElementSelector(ElementSelector node) => visitSimpleSelector(node); | 283 visitElementSelector(ElementSelector node) => visitSimpleSelector(node); |
| 278 | 284 |
| 279 void visitAttributeSelector(AttributeSelector node) { | 285 visitAttributeSelector(AttributeSelector node) { |
| 280 visitSimpleSelector(node); | 286 visitSimpleSelector(node); |
| 281 } | 287 } |
| 282 | 288 |
| 283 void visitIdSelector(IdSelector node) => visitSimpleSelector(node); | 289 visitIdSelector(IdSelector node) => visitSimpleSelector(node); |
| 284 | 290 |
| 285 void visitClassSelector(ClassSelector node) => visitSimpleSelector(node); | 291 visitClassSelector(ClassSelector node) => visitSimpleSelector(node); |
| 286 | 292 |
| 287 void visitPseudoClassSelector(PseudoClassSelector node) => | 293 visitPseudoClassSelector(PseudoClassSelector node) => |
| 288 visitSimpleSelector(node); | 294 visitSimpleSelector(node); |
| 289 | 295 |
| 290 void visitPseudoElementSelector(PseudoElementSelector node) => | 296 visitPseudoElementSelector(PseudoElementSelector node) => |
| 291 visitSimpleSelector(node); | 297 visitSimpleSelector(node); |
| 292 | 298 |
| 293 void visitPseudoClassFunctionSelector(PseudoClassFunctionSelector node) => | 299 visitPseudoClassFunctionSelector(PseudoClassFunctionSelector node) => |
| 294 visitSimpleSelector(node); | 300 visitSimpleSelector(node); |
| 295 | 301 |
| 296 void visitPseudoElementFunctionSelector(PseudoElementFunctionSelector node) => | 302 visitPseudoElementFunctionSelector(PseudoElementFunctionSelector node) => |
| 297 visitSimpleSelector(node); | 303 visitSimpleSelector(node); |
| 298 | 304 |
| 299 void visitNegationSelector(NegationSelector node) => | 305 visitNegationSelector(NegationSelector node) => |
| 300 visitSimpleSelector(node); | 306 visitSimpleSelector(node); |
| 301 | 307 |
| 302 void visitSelectorExpression(SelectorExpression node) { | 308 visitSelectorExpression(SelectorExpression node) { |
| 303 _visitNodeList(node.expressions); | 309 _visitNodeList(node.expressions); |
| 304 } | 310 } |
| 305 | 311 |
| 306 void visitUnicodeRangeTerm(UnicodeRangeTerm node) {} | 312 visitUnicodeRangeTerm(UnicodeRangeTerm node) {} |
| 307 | 313 |
| 308 void visitLiteralTerm(LiteralTerm node) {} | 314 visitLiteralTerm(LiteralTerm node) {} |
| 309 | 315 |
| 310 void visitHexColorTerm(HexColorTerm node) {} | 316 visitHexColorTerm(HexColorTerm node) {} |
| 311 | 317 |
| 312 void visitNumberTerm(NumberTerm node) {} | 318 visitNumberTerm(NumberTerm node) {} |
| 313 | 319 |
| 314 void visitUnitTerm(UnitTerm node) {} | 320 visitUnitTerm(UnitTerm node) {} |
| 315 | 321 |
| 316 void visitLengthTerm(LengthTerm node) { | 322 visitLengthTerm(LengthTerm node) { |
| 317 visitUnitTerm(node); | 323 visitUnitTerm(node); |
| 318 } | 324 } |
| 319 | 325 |
| 320 void visitPercentageTerm(PercentageTerm node) { | 326 visitPercentageTerm(PercentageTerm node) { |
| 321 visitLiteralTerm(node); | 327 visitLiteralTerm(node); |
| 322 } | 328 } |
| 323 | 329 |
| 324 void visitEmTerm(EmTerm node) { | 330 visitEmTerm(EmTerm node) { |
| 325 visitLiteralTerm(node); | 331 visitLiteralTerm(node); |
| 326 } | 332 } |
| 327 | 333 |
| 328 void visitExTerm(ExTerm node) { | 334 visitExTerm(ExTerm node) { |
| 329 visitLiteralTerm(node); | 335 visitLiteralTerm(node); |
| 330 } | 336 } |
| 331 | 337 |
| 332 void visitAngleTerm(AngleTerm node) { | 338 visitAngleTerm(AngleTerm node) { |
| 333 visitUnitTerm(node); | 339 visitUnitTerm(node); |
| 334 } | 340 } |
| 335 | 341 |
| 336 void visitTimeTerm(TimeTerm node) { | 342 visitTimeTerm(TimeTerm node) { |
| 337 visitUnitTerm(node); | 343 visitUnitTerm(node); |
| 338 } | 344 } |
| 339 | 345 |
| 340 void visitFreqTerm(FreqTerm node) { | 346 visitFreqTerm(FreqTerm node) { |
| 341 visitUnitTerm(node); | 347 visitUnitTerm(node); |
| 342 } | 348 } |
| 343 | 349 |
| 344 void visitFractionTerm(FractionTerm node) { | 350 visitFractionTerm(FractionTerm node) { |
| 345 visitLiteralTerm(node); | 351 visitLiteralTerm(node); |
| 346 } | 352 } |
| 347 | 353 |
| 348 void visitUriTerm(UriTerm node) { | 354 visitUriTerm(UriTerm node) { |
| 349 visitLiteralTerm(node); | 355 visitLiteralTerm(node); |
| 350 } | 356 } |
| 351 | 357 |
| 352 void visitResolutionTerm(ResolutionTerm node) { | 358 visitResolutionTerm(ResolutionTerm node) { |
| 353 visitUnitTerm(node); | 359 visitUnitTerm(node); |
| 354 } | 360 } |
| 355 | 361 |
| 356 void visitChTerm(ChTerm node) { | 362 visitChTerm(ChTerm node) { |
| 357 visitUnitTerm(node); | 363 visitUnitTerm(node); |
| 358 } | 364 } |
| 359 | 365 |
| 360 void visitRemTerm(RemTerm node) { | 366 visitRemTerm(RemTerm node) { |
| 361 visitUnitTerm(node); | 367 visitUnitTerm(node); |
| 362 } | 368 } |
| 363 | 369 |
| 364 void visitViewportTerm(ViewportTerm node) { | 370 visitViewportTerm(ViewportTerm node) { |
| 365 visitUnitTerm(node); | 371 visitUnitTerm(node); |
| 366 } | 372 } |
| 367 | 373 |
| 368 void visitFunctionTerm(FunctionTerm node) { | 374 visitFunctionTerm(FunctionTerm node) { |
| 369 visitLiteralTerm(node); | 375 visitLiteralTerm(node); |
| 370 visitExpressions(node._params); | 376 visitExpressions(node._params); |
| 371 } | 377 } |
| 372 | 378 |
| 373 void visitGroupTerm(GroupTerm node) { | 379 visitGroupTerm(GroupTerm node) { |
| 374 for (var term in node._terms) { | 380 for (var term in node._terms) { |
| 375 term.visit(this); | 381 term.visit(this); |
| 376 } | 382 } |
| 377 } | 383 } |
| 378 | 384 |
| 379 void visitItemTerm(ItemTerm node) { | 385 visitItemTerm(ItemTerm node) { |
| 380 visitNumberTerm(node); | 386 visitNumberTerm(node); |
| 381 } | 387 } |
| 382 | 388 |
| 383 void visitIE8Term(IE8Term node) {} | 389 visitIE8Term(IE8Term node) {} |
| 384 | 390 |
| 385 void visitOperatorSlash(OperatorSlash node) {} | 391 visitOperatorSlash(OperatorSlash node) {} |
| 386 | 392 |
| 387 void visitOperatorComma(OperatorComma node) {} | 393 visitOperatorComma(OperatorComma node) {} |
| 388 | 394 |
| 389 void visitOperatorPlus(OperatorPlus node) {} | 395 visitOperatorPlus(OperatorPlus node) {} |
| 390 | 396 |
| 391 void visitOperatorMinus(OperatorMinus node) {} | 397 visitOperatorMinus(OperatorMinus node) {} |
| 392 | 398 |
| 393 void visitVarUsage(VarUsage node) { | 399 visitVarUsage(VarUsage node) { |
| 394 _visitNodeList(node.defaultValues); | 400 _visitNodeList(node.defaultValues); |
| 395 } | 401 } |
| 396 | 402 |
| 397 void visitExpressions(Expressions node) { | 403 visitExpressions(Expressions node) { |
| 398 _visitNodeList(node.expressions); | 404 _visitNodeList(node.expressions); |
| 399 } | 405 } |
| 400 | 406 |
| 401 void visitBinaryExpression(BinaryExpression node) { | 407 visitBinaryExpression(BinaryExpression node) { |
| 402 // TODO(terry): TBD | 408 // TODO(terry): TBD |
| 403 throw UnimplementedError; | 409 throw new UnimplementedError(); |
| 404 } | 410 } |
| 405 | 411 |
| 406 void visitUnaryExpression(UnaryExpression node) { | 412 visitUnaryExpression(UnaryExpression node) { |
| 407 // TODO(terry): TBD | 413 // TODO(terry): TBD |
| 408 throw UnimplementedError; | 414 throw new UnimplementedError(); |
| 409 } | 415 } |
| 410 | 416 |
| 411 void visitIdentifier(Identifier node) {} | 417 visitIdentifier(Identifier node) {} |
| 412 | 418 |
| 413 void visitWildcard(Wildcard node) {} | 419 visitWildcard(Wildcard node) {} |
| 414 | 420 |
| 415 void visitThisOperator(ThisOperator node) {} | 421 visitThisOperator(ThisOperator node) {} |
| 416 | 422 |
| 417 void visitNegation(Negation node) {} | 423 visitNegation(Negation node) {} |
| 418 | 424 |
| 419 void visitDartStyleExpression(DartStyleExpression node) {} | 425 visitDartStyleExpression(DartStyleExpression node) {} |
| 420 | 426 |
| 421 void visitFontExpression(FontExpression node) { | 427 visitFontExpression(FontExpression node) { |
| 422 // TODO(terry): TBD | 428 // TODO(terry): TBD |
| 423 throw UnimplementedError; | 429 throw new UnimplementedError(); |
| 424 } | 430 } |
| 425 | 431 |
| 426 void visitBoxExpression(BoxExpression node) { | 432 visitBoxExpression(BoxExpression node) { |
| 427 // TODO(terry): TBD | 433 // TODO(terry): TBD |
| 428 throw UnimplementedError; | 434 throw new UnimplementedError(); |
| 429 } | 435 } |
| 430 | 436 |
| 431 void visitMarginExpression(MarginExpression node) { | 437 visitMarginExpression(MarginExpression node) { |
| 432 // TODO(terry): TBD | 438 // TODO(terry): TBD |
| 433 throw UnimplementedError; | 439 throw new UnimplementedError(); |
| 434 } | 440 } |
| 435 | 441 |
| 436 void visitBorderExpression(BorderExpression node) { | 442 visitBorderExpression(BorderExpression node) { |
| 437 // TODO(terry): TBD | 443 // TODO(terry): TBD |
| 438 throw UnimplementedError; | 444 throw new UnimplementedError(); |
| 439 } | 445 } |
| 440 | 446 |
| 441 void visitHeightExpression(HeightExpression node) { | 447 visitHeightExpression(HeightExpression node) { |
| 442 // TODO(terry): TB | 448 // TODO(terry): TB |
| 443 throw UnimplementedError; | 449 throw new UnimplementedError(); |
| 444 } | 450 } |
| 445 | 451 |
| 446 void visitPaddingExpression(PaddingExpression node) { | 452 visitPaddingExpression(PaddingExpression node) { |
| 447 // TODO(terry): TBD | 453 // TODO(terry): TBD |
| 448 throw UnimplementedError; | 454 throw new UnimplementedError(); |
| 449 } | 455 } |
| 450 | 456 |
| 451 void visitWidthExpression(WidthExpression node) { | 457 visitWidthExpression(WidthExpression node) { |
| 452 // TODO(terry): TBD | 458 // TODO(terry): TBD |
| 453 throw UnimplementedError; | 459 throw new UnimplementedError(); |
| 454 } | 460 } |
| 455 } | 461 } |
| OLD | NEW |