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'; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 list[index].visit(this); | 119 list[index].visit(this); |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 void visitTree(StyleSheet tree) => visitStyleSheet(tree); | 123 void visitTree(StyleSheet tree) => visitStyleSheet(tree); |
124 | 124 |
125 void visitStyleSheet(StyleSheet ss) { | 125 void visitStyleSheet(StyleSheet ss) { |
126 _visitNodeList(ss.topLevels); | 126 _visitNodeList(ss.topLevels); |
127 } | 127 } |
128 | 128 |
129 void visitNoOp(NoOp node) { } | 129 void visitNoOp(NoOp node) {} |
130 | 130 |
131 void visitTopLevelProduction(TopLevelProduction node) { } | 131 void visitTopLevelProduction(TopLevelProduction node) {} |
132 | 132 |
133 void visitDirective(Directive node) { } | 133 void visitDirective(Directive node) {} |
134 | 134 |
135 void visitCssComment(CssComment node) { } | 135 void visitCssComment(CssComment node) {} |
136 | 136 |
137 void visitCommentDefinition(CommentDefinition node) { } | 137 void visitCommentDefinition(CommentDefinition node) {} |
138 | 138 |
139 void visitMediaExpression(MediaExpression node) { | 139 void visitMediaExpression(MediaExpression node) { |
140 visitExpressions(node.exprs); | 140 visitExpressions(node.exprs); |
141 } | 141 } |
142 | 142 |
143 void visitMediaQuery(MediaQuery node) { | 143 void visitMediaQuery(MediaQuery node) { |
144 for (var mediaExpr in node.expressions) { | 144 for (var mediaExpr in node.expressions) { |
145 visitMediaExpression(mediaExpr); | 145 visitMediaExpression(mediaExpr); |
146 } | 146 } |
147 } | 147 } |
(...skipping 16 matching lines...) Expand all Loading... |
164 void visitPageDirective(PageDirective node) { | 164 void visitPageDirective(PageDirective node) { |
165 for (var declGroup in node._declsMargin) { | 165 for (var declGroup in node._declsMargin) { |
166 if (declGroup is MarginGroup) { | 166 if (declGroup is MarginGroup) { |
167 visitMarginGroup(declGroup); | 167 visitMarginGroup(declGroup); |
168 } else { | 168 } else { |
169 visitDeclarationGroup(declGroup); | 169 visitDeclarationGroup(declGroup); |
170 } | 170 } |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
174 void visitCharsetDirective(CharsetDirective node) { } | 174 void visitCharsetDirective(CharsetDirective node) {} |
175 | 175 |
176 void visitImportDirective(ImportDirective node) { | 176 void visitImportDirective(ImportDirective node) { |
177 for (var mediaQuery in node.mediaQueries) { | 177 for (var mediaQuery in node.mediaQueries) { |
178 visitMediaQuery(mediaQuery); | 178 visitMediaQuery(mediaQuery); |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 void visitKeyFrameDirective(KeyFrameDirective node) { | 182 void visitKeyFrameDirective(KeyFrameDirective node) { |
183 visitIdentifier(node.name); | 183 visitIdentifier(node.name); |
184 _visitNodeList(node._blocks); | 184 _visitNodeList(node._blocks); |
185 } | 185 } |
186 | 186 |
187 void visitKeyFrameBlock(KeyFrameBlock node) { | 187 void visitKeyFrameBlock(KeyFrameBlock node) { |
188 visitExpressions(node._blockSelectors); | 188 visitExpressions(node._blockSelectors); |
189 visitDeclarationGroup(node._declarations); | 189 visitDeclarationGroup(node._declarations); |
190 } | 190 } |
191 | 191 |
192 void visitFontFaceDirective(FontFaceDirective node) { | 192 void visitFontFaceDirective(FontFaceDirective node) { |
193 visitDeclarationGroup(node._declarations); | 193 visitDeclarationGroup(node._declarations); |
194 } | 194 } |
195 | 195 |
196 void visitStyletDirective(StyletDirective node) { | 196 void visitStyletDirective(StyletDirective node) { |
197 _visitNodeList(node.rulesets); | 197 _visitNodeList(node.rulesets); |
198 } | 198 } |
199 | 199 |
200 void visitNamespaceDirective(NamespaceDirective node) { } | 200 void visitNamespaceDirective(NamespaceDirective node) {} |
201 | 201 |
202 void visitVarDefinitionDirective(VarDefinitionDirective node) { | 202 void visitVarDefinitionDirective(VarDefinitionDirective node) { |
203 visitVarDefinition(node.def); | 203 visitVarDefinition(node.def); |
204 } | 204 } |
205 | 205 |
206 void visitMixinRulesetDirective(MixinRulesetDirective node) { | 206 void visitMixinRulesetDirective(MixinRulesetDirective node) { |
207 _visitNodeList(node.rulesets); | 207 _visitNodeList(node.rulesets); |
208 } | 208 } |
209 | 209 |
210 void visitMixinDefinition(MixinDefinition node) { } | 210 void visitMixinDefinition(MixinDefinition node) {} |
211 | 211 |
212 void visitMixinDeclarationDirective(MixinDeclarationDirective node) { | 212 void visitMixinDeclarationDirective(MixinDeclarationDirective node) { |
213 visitDeclarationGroup(node.declarations); | 213 visitDeclarationGroup(node.declarations); |
214 } | 214 } |
215 | 215 |
216 void visitIncludeDirective(IncludeDirective node) { | 216 void visitIncludeDirective(IncludeDirective node) { |
217 for (var index = 0; index < node.args.length; index++) { | 217 for (var index = 0; index < node.args.length; index++) { |
218 var param = node.args[index]; | 218 var param = node.args[index]; |
219 _visitNodeList(param); | 219 _visitNodeList(param); |
220 } | 220 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 void visitPseudoElementFunctionSelector(PseudoElementFunctionSelector node) => | 296 void visitPseudoElementFunctionSelector(PseudoElementFunctionSelector node) => |
297 visitSimpleSelector(node); | 297 visitSimpleSelector(node); |
298 | 298 |
299 void visitNegationSelector(NegationSelector node) => | 299 void visitNegationSelector(NegationSelector node) => |
300 visitSimpleSelector(node); | 300 visitSimpleSelector(node); |
301 | 301 |
302 void visitSelectorExpression(SelectorExpression node) { | 302 void visitSelectorExpression(SelectorExpression node) { |
303 _visitNodeList(node.expressions); | 303 _visitNodeList(node.expressions); |
304 } | 304 } |
305 | 305 |
306 void visitUnicodeRangeTerm(UnicodeRangeTerm node) { } | 306 void visitUnicodeRangeTerm(UnicodeRangeTerm node) {} |
307 | 307 |
308 void visitLiteralTerm(LiteralTerm node) { } | 308 void visitLiteralTerm(LiteralTerm node) {} |
309 | 309 |
310 void visitHexColorTerm(HexColorTerm node) { } | 310 void visitHexColorTerm(HexColorTerm node) {} |
311 | 311 |
312 void visitNumberTerm(NumberTerm node) { } | 312 void visitNumberTerm(NumberTerm node) {} |
313 | 313 |
314 void visitUnitTerm(UnitTerm node) { } | 314 void visitUnitTerm(UnitTerm node) {} |
315 | 315 |
316 void visitLengthTerm(LengthTerm node) { | 316 void visitLengthTerm(LengthTerm node) { |
317 visitUnitTerm(node); | 317 visitUnitTerm(node); |
318 } | 318 } |
319 | 319 |
320 void visitPercentageTerm(PercentageTerm node) { | 320 void visitPercentageTerm(PercentageTerm node) { |
321 visitLiteralTerm(node); | 321 visitLiteralTerm(node); |
322 } | 322 } |
323 | 323 |
324 void visitEmTerm(EmTerm node) { | 324 void visitEmTerm(EmTerm node) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 void visitGroupTerm(GroupTerm node) { | 373 void visitGroupTerm(GroupTerm node) { |
374 for (var term in node._terms) { | 374 for (var term in node._terms) { |
375 term.visit(this); | 375 term.visit(this); |
376 } | 376 } |
377 } | 377 } |
378 | 378 |
379 void visitItemTerm(ItemTerm node) { | 379 void visitItemTerm(ItemTerm node) { |
380 visitNumberTerm(node); | 380 visitNumberTerm(node); |
381 } | 381 } |
382 | 382 |
383 void visitIE8Term(IE8Term node) { } | 383 void visitIE8Term(IE8Term node) {} |
384 | 384 |
385 void visitOperatorSlash(OperatorSlash node) { } | 385 void visitOperatorSlash(OperatorSlash node) {} |
386 | 386 |
387 void visitOperatorComma(OperatorComma node) { } | 387 void visitOperatorComma(OperatorComma node) {} |
388 | 388 |
389 void visitOperatorPlus(OperatorPlus node) { } | 389 void visitOperatorPlus(OperatorPlus node) {} |
390 | 390 |
391 void visitOperatorMinus(OperatorMinus node) { } | 391 void visitOperatorMinus(OperatorMinus node) {} |
392 | 392 |
393 void visitVarUsage(VarUsage node) { | 393 void visitVarUsage(VarUsage node) { |
394 _visitNodeList(node.defaultValues); | 394 _visitNodeList(node.defaultValues); |
395 } | 395 } |
396 | 396 |
397 void visitExpressions(Expressions node) { | 397 void visitExpressions(Expressions node) { |
398 _visitNodeList(node.expressions); | 398 _visitNodeList(node.expressions); |
399 } | 399 } |
400 | 400 |
401 void visitBinaryExpression(BinaryExpression node) { | 401 void visitBinaryExpression(BinaryExpression node) { |
402 // TODO(terry): TBD | 402 // TODO(terry): TBD |
403 throw UnimplementedError; | 403 throw UnimplementedError; |
404 } | 404 } |
405 | 405 |
406 void visitUnaryExpression(UnaryExpression node) { | 406 void visitUnaryExpression(UnaryExpression node) { |
407 // TODO(terry): TBD | 407 // TODO(terry): TBD |
408 throw UnimplementedError; | 408 throw UnimplementedError; |
409 } | 409 } |
410 | 410 |
411 void visitIdentifier(Identifier node) { } | 411 void visitIdentifier(Identifier node) {} |
412 | 412 |
413 void visitWildcard(Wildcard node) { } | 413 void visitWildcard(Wildcard node) {} |
414 | 414 |
415 void visitThisOperator(ThisOperator node) { } | 415 void visitThisOperator(ThisOperator node) {} |
416 | 416 |
417 void visitNegation(Negation node) { } | 417 void visitNegation(Negation node) {} |
418 | 418 |
419 void visitDartStyleExpression(DartStyleExpression node) { } | 419 void visitDartStyleExpression(DartStyleExpression node) {} |
420 | 420 |
421 void visitFontExpression(FontExpression node) { | 421 void visitFontExpression(FontExpression node) { |
422 // TODO(terry): TBD | 422 // TODO(terry): TBD |
423 throw UnimplementedError; | 423 throw UnimplementedError; |
424 } | 424 } |
425 | 425 |
426 void visitBoxExpression(BoxExpression node) { | 426 void visitBoxExpression(BoxExpression node) { |
427 // TODO(terry): TBD | 427 // TODO(terry): TBD |
428 throw UnimplementedError; | 428 throw UnimplementedError; |
429 } | 429 } |
(...skipping 16 matching lines...) Expand all Loading... |
446 void visitPaddingExpression(PaddingExpression node) { | 446 void visitPaddingExpression(PaddingExpression node) { |
447 // TODO(terry): TBD | 447 // TODO(terry): TBD |
448 throw UnimplementedError; | 448 throw UnimplementedError; |
449 } | 449 } |
450 | 450 |
451 void visitWidthExpression(WidthExpression node) { | 451 void visitWidthExpression(WidthExpression node) { |
452 // TODO(terry): TBD | 452 // TODO(terry): TBD |
453 throw UnimplementedError; | 453 throw UnimplementedError; |
454 } | 454 } |
455 } | 455 } |
OLD | NEW |