| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
| 3 * | 3 * |
| 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
| 5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
| 6 * | 6 * |
| 7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
| 8 * | 8 * |
| 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
| 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
| 11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
| 12 * the License. | 12 * the License. |
| 13 */ | 13 */ |
| 14 package com.google.dart.engine.html.ast.visitor; | 14 package com.google.dart.engine.html.ast.visitor; |
| 15 | 15 |
| 16 import com.google.dart.engine.html.ast.HtmlScriptTagNode; |
| 16 import com.google.dart.engine.html.ast.HtmlUnit; | 17 import com.google.dart.engine.html.ast.HtmlUnit; |
| 17 import com.google.dart.engine.html.ast.XmlAttributeNode; | 18 import com.google.dart.engine.html.ast.XmlAttributeNode; |
| 18 import com.google.dart.engine.html.ast.XmlNode; | 19 import com.google.dart.engine.html.ast.XmlNode; |
| 19 import com.google.dart.engine.html.ast.XmlTagNode; | 20 import com.google.dart.engine.html.ast.XmlTagNode; |
| 20 import com.google.dart.engine.html.scanner.Token; | 21 import com.google.dart.engine.html.scanner.Token; |
| 21 | 22 |
| 22 import java.io.PrintWriter; | 23 import java.io.PrintWriter; |
| 23 | 24 |
| 24 /** | 25 /** |
| 25 * Instances of the class {@code ToSourceVisitor} write a source representation
of a visited XML | 26 * Instances of the class {@code ToSourceVisitor} write a source representation
of a visited XML |
| (...skipping 11 matching lines...) Expand all Loading... |
| 37 * Initialize a newly created visitor to write source code representing the vi
sited nodes to the | 38 * Initialize a newly created visitor to write source code representing the vi
sited nodes to the |
| 38 * given writer. | 39 * given writer. |
| 39 * | 40 * |
| 40 * @param writer the writer to which the source is to be written | 41 * @param writer the writer to which the source is to be written |
| 41 */ | 42 */ |
| 42 public ToSourceVisitor(PrintWriter writer) { | 43 public ToSourceVisitor(PrintWriter writer) { |
| 43 this.writer = writer; | 44 this.writer = writer; |
| 44 } | 45 } |
| 45 | 46 |
| 46 @Override | 47 @Override |
| 48 public Void visitHtmlScriptTagNode(HtmlScriptTagNode node) { |
| 49 return visitXmlTagNode(node); |
| 50 } |
| 51 |
| 52 @Override |
| 47 public Void visitHtmlUnit(HtmlUnit node) { | 53 public Void visitHtmlUnit(HtmlUnit node) { |
| 48 for (XmlTagNode child : node.getTagNodes()) { | 54 for (XmlTagNode child : node.getTagNodes()) { |
| 49 visit(child); | 55 visit(child); |
| 50 } | 56 } |
| 51 return null; | 57 return null; |
| 52 } | 58 } |
| 53 | 59 |
| 54 @Override | 60 @Override |
| 55 public Void visitXmlAttributeNode(XmlAttributeNode node) { | 61 public Void visitXmlAttributeNode(XmlAttributeNode node) { |
| 56 String name = node.getName().getLexeme(); | 62 String name = node.getName().getLexeme(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 * Safely visit the given node. | 100 * Safely visit the given node. |
| 95 * | 101 * |
| 96 * @param node the node to be visited | 102 * @param node the node to be visited |
| 97 */ | 103 */ |
| 98 private void visit(XmlNode node) { | 104 private void visit(XmlNode node) { |
| 99 if (node != null) { | 105 if (node != null) { |
| 100 node.accept(this); | 106 node.accept(this); |
| 101 } | 107 } |
| 102 } | 108 } |
| 103 } | 109 } |
| OLD | NEW |