OLD | NEW |
1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
3 library engine.html; | 3 library engine.html; |
4 import 'dart:collection'; | 4 import 'dart:collection'; |
5 import 'java_core.dart'; | 5 import 'java_core.dart'; |
6 import 'java_engine.dart'; | 6 import 'java_engine.dart'; |
7 import 'source.dart'; | 7 import 'source.dart'; |
8 import 'error.dart'; | 8 import 'error.dart'; |
9 import 'instrumentation.dart'; | 9 import 'instrumentation.dart'; |
10 import 'element.dart' show HtmlElementImpl; | 10 import 'element.dart' show HtmlElementImpl; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 * Return the last token included in this node's source range. | 221 * Return the last token included in this node's source range. |
222 * @return the last token or {@code null} if none | 222 * @return the last token or {@code null} if none |
223 */ | 223 */ |
224 Token get endToken; | 224 Token get endToken; |
225 | 225 |
226 /** | 226 /** |
227 * Return the number of characters in the node's source range. | 227 * Return the number of characters in the node's source range. |
228 * @return the number of characters in the node's source range | 228 * @return the number of characters in the node's source range |
229 */ | 229 */ |
230 int get length { | 230 int get length { |
231 Token beginToken2 = beginToken; | 231 Token beginToken = this.beginToken; |
232 Token endToken2 = endToken; | 232 Token endToken = this.endToken; |
233 if (beginToken2 == null || endToken2 == null) { | 233 if (beginToken == null || endToken == null) { |
234 return -1; | 234 return -1; |
235 } | 235 } |
236 return endToken2.offset + endToken2.length - beginToken2.offset; | 236 return endToken.offset + endToken.length - beginToken.offset; |
237 } | 237 } |
238 | 238 |
239 /** | 239 /** |
240 * Return the offset from the beginning of the file to the first character in
the node's source | 240 * Return the offset from the beginning of the file to the first character in
the node's source |
241 * range. | 241 * range. |
242 * @return the offset from the beginning of the file to the first character in
the node's source | 242 * @return the offset from the beginning of the file to the first character in
the node's source |
243 * range | 243 * range |
244 */ | 244 */ |
245 int get offset { | 245 int get offset { |
246 Token beginToken2 = beginToken; | 246 Token beginToken = this.beginToken; |
247 if (beginToken2 == null) { | 247 if (beginToken == null) { |
248 return -1; | 248 return -1; |
249 } | 249 } |
250 return beginToken.offset; | 250 return beginToken.offset; |
251 } | 251 } |
252 | 252 |
253 /** | 253 /** |
254 * Return this node's parent node, or {@code null} if this node is the root of
an AST structure. | 254 * Return this node's parent node, or {@code null} if this node is the root of
an AST structure. |
255 * <p> | 255 * <p> |
256 * Note that the relationship between an AST node and its parent node may chan
ge over the lifetime | 256 * Note that the relationship between an AST node and its parent node may chan
ge over the lifetime |
257 * of a node. | 257 * of a node. |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 ToSourceVisitor(PrintWriter writer) { | 800 ToSourceVisitor(PrintWriter writer) { |
801 this._writer = writer; | 801 this._writer = writer; |
802 } | 802 } |
803 Object visitHtmlUnit(HtmlUnit node) { | 803 Object visitHtmlUnit(HtmlUnit node) { |
804 for (XmlTagNode child in node.tagNodes) { | 804 for (XmlTagNode child in node.tagNodes) { |
805 visit(child); | 805 visit(child); |
806 } | 806 } |
807 return null; | 807 return null; |
808 } | 808 } |
809 Object visitXmlAttributeNode(XmlAttributeNode node) { | 809 Object visitXmlAttributeNode(XmlAttributeNode node) { |
810 String name2 = node.name.lexeme; | 810 String name = node.name.lexeme; |
811 Token value2 = node.value; | 811 Token value = node.value; |
812 if (name2.length == 0) { | 812 if (name.length == 0) { |
813 _writer.print("__"); | 813 _writer.print("__"); |
814 } else { | 814 } else { |
815 _writer.print(name2); | 815 _writer.print(name); |
816 } | 816 } |
817 _writer.print("="); | 817 _writer.print("="); |
818 if (value2 == null) { | 818 if (value == null) { |
819 _writer.print("__"); | 819 _writer.print("__"); |
820 } else { | 820 } else { |
821 _writer.print(value2.lexeme); | 821 _writer.print(value.lexeme); |
822 } | 822 } |
823 return null; | 823 return null; |
824 } | 824 } |
825 Object visitXmlTagNode(XmlTagNode node) { | 825 Object visitXmlTagNode(XmlTagNode node) { |
826 _writer.print("<"); | 826 _writer.print("<"); |
827 String tagName = node.tag.lexeme; | 827 String tagName = node.tag.lexeme; |
828 _writer.print(tagName); | 828 _writer.print(tagName); |
829 for (XmlAttributeNode attribute in node.attributes) { | 829 for (XmlAttributeNode attribute in node.attributes) { |
830 _writer.print(" "); | 830 _writer.print(" "); |
831 visit(attribute); | 831 visit(attribute); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 } | 1155 } |
1156 return new XmlAttributeNode(name, equals, value); | 1156 return new XmlAttributeNode(name, equals, value); |
1157 } | 1157 } |
1158 | 1158 |
1159 /** | 1159 /** |
1160 * Parse the stream for a sequence of attributes. This method advances the cur
rent token to the | 1160 * Parse the stream for a sequence of attributes. This method advances the cur
rent token to the |
1161 * next {@link TokenType#GT}, {@link TokenType#SLASH_GT}, or {@link TokenType#
EOF}. | 1161 * next {@link TokenType#GT}, {@link TokenType#SLASH_GT}, or {@link TokenType#
EOF}. |
1162 * @return a collection of zero or more attributes (not {@code null}, contains
no {@code null}s) | 1162 * @return a collection of zero or more attributes (not {@code null}, contains
no {@code null}s) |
1163 */ | 1163 */ |
1164 List<XmlAttributeNode> parseAttributes() { | 1164 List<XmlAttributeNode> parseAttributes() { |
1165 TokenType type2 = _currentToken.type; | 1165 TokenType type = _currentToken.type; |
1166 if (identical(type2, TokenType.GT) || identical(type2, TokenType.SLASH_GT) |
| identical(type2, TokenType.EOF)) { | 1166 if (identical(type, TokenType.GT) || identical(type, TokenType.SLASH_GT) ||
identical(type, TokenType.EOF)) { |
1167 return XmlTagNode.NO_ATTRIBUTES; | 1167 return XmlTagNode.NO_ATTRIBUTES; |
1168 } | 1168 } |
1169 List<XmlAttributeNode> attributes = new List<XmlAttributeNode>(); | 1169 List<XmlAttributeNode> attributes = new List<XmlAttributeNode>(); |
1170 while (true) { | 1170 while (true) { |
1171 while (true) { | 1171 while (true) { |
1172 if (_currentToken.type == TokenType.GT || _currentToken.type == TokenTyp
e.SLASH_GT || _currentToken.type == TokenType.EOF) { | 1172 if (_currentToken.type == TokenType.GT || _currentToken.type == TokenTyp
e.SLASH_GT || _currentToken.type == TokenType.EOF) { |
1173 return attributes; | 1173 return attributes; |
1174 } else if (_currentToken.type == TokenType.TAG) { | 1174 } else if (_currentToken.type == TokenType.TAG) { |
1175 attributes.add(parseAttribute()); | 1175 attributes.add(parseAttribute()); |
1176 } else { | 1176 } else { |
1177 reportUnexpectedToken(); | 1177 reportUnexpectedToken(); |
1178 _currentToken = _currentToken.next; | 1178 _currentToken = _currentToken.next; |
1179 } | 1179 } |
1180 break; | 1180 break; |
1181 } | 1181 } |
1182 } | 1182 } |
1183 } | 1183 } |
1184 | 1184 |
1185 /** | 1185 /** |
1186 * Parse the stream for a sequence of tag nodes existing within a parent tag n
ode. This method | 1186 * Parse the stream for a sequence of tag nodes existing within a parent tag n
ode. This method |
1187 * advances the current token to the next {@link TokenType#LT_SLASH} or {@link
TokenType#EOF}. | 1187 * advances the current token to the next {@link TokenType#LT_SLASH} or {@link
TokenType#EOF}. |
1188 * @return a list of nodes (not {@code null}, contains no {@code null}s) | 1188 * @return a list of nodes (not {@code null}, contains no {@code null}s) |
1189 */ | 1189 */ |
1190 List<XmlTagNode> parseChildTagNodes() { | 1190 List<XmlTagNode> parseChildTagNodes() { |
1191 TokenType type2 = _currentToken.type; | 1191 TokenType type = _currentToken.type; |
1192 if (identical(type2, TokenType.LT_SLASH) || identical(type2, TokenType.EOF))
{ | 1192 if (identical(type, TokenType.LT_SLASH) || identical(type, TokenType.EOF)) { |
1193 return XmlTagNode.NO_TAG_NODES; | 1193 return XmlTagNode.NO_TAG_NODES; |
1194 } | 1194 } |
1195 List<XmlTagNode> nodes = new List<XmlTagNode>(); | 1195 List<XmlTagNode> nodes = new List<XmlTagNode>(); |
1196 while (true) { | 1196 while (true) { |
1197 while (true) { | 1197 while (true) { |
1198 if (_currentToken.type == TokenType.LT) { | 1198 if (_currentToken.type == TokenType.LT) { |
1199 nodes.add(parseTagNode()); | 1199 nodes.add(parseTagNode()); |
1200 } else if (_currentToken.type == TokenType.LT_SLASH || _currentToken.typ
e == TokenType.EOF) { | 1200 } else if (_currentToken.type == TokenType.LT_SLASH || _currentToken.typ
e == TokenType.EOF) { |
1201 return nodes; | 1201 return nodes; |
1202 } else if (_currentToken.type == TokenType.COMMENT) { | 1202 } else if (_currentToken.type == TokenType.COMMENT) { |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1619 */ | 1619 */ |
1620 void set element(HtmlElementImpl element2) { | 1620 void set element(HtmlElementImpl element2) { |
1621 this._element = element2; | 1621 this._element = element2; |
1622 } | 1622 } |
1623 void visitChildren(XmlVisitor<Object> visitor) { | 1623 void visitChildren(XmlVisitor<Object> visitor) { |
1624 for (XmlTagNode node in _tagNodes) { | 1624 for (XmlTagNode node in _tagNodes) { |
1625 node.accept(visitor); | 1625 node.accept(visitor); |
1626 } | 1626 } |
1627 } | 1627 } |
1628 } | 1628 } |
OLD | NEW |