OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | |
6 // significant change. Please see the README file for more information. | |
7 | |
8 library engine.html; | 5 library engine.html; |
9 | 6 |
10 import 'dart:collection'; | 7 import 'dart:collection'; |
11 | 8 |
12 import 'ast.dart'; | 9 import 'ast.dart'; |
13 import 'element.dart'; | 10 import 'element.dart'; |
14 import 'engine.dart' show AnalysisOptions, AnalysisEngine; | 11 import 'engine.dart' show AnalysisOptions, AnalysisEngine; |
15 import 'error.dart' show AnalysisErrorListener; | 12 import 'error.dart' show AnalysisErrorListener; |
16 import 'java_core.dart'; | 13 import 'java_core.dart'; |
17 import 'java_engine.dart'; | 14 import 'java_engine.dart'; |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 * listener to which errors will be reported. [_options] is the analysis | 394 * listener to which errors will be reported. [_options] is the analysis |
398 * options which should be used for parsing. | 395 * options which should be used for parsing. |
399 */ | 396 */ |
400 HtmlParser(Source source, this._errorListener, this._options) : super(source); | 397 HtmlParser(Source source, this._errorListener, this._options) : super(source); |
401 | 398 |
402 @override | 399 @override |
403 XmlAttributeNode createAttributeNode(Token name, Token equals, Token value) => | 400 XmlAttributeNode createAttributeNode(Token name, Token equals, Token value) => |
404 new XmlAttributeNode(name, equals, value); | 401 new XmlAttributeNode(name, equals, value); |
405 | 402 |
406 @override | 403 @override |
407 XmlTagNode createTagNode(Token nodeStart, Token tag, | 404 XmlTagNode createTagNode( |
408 List<XmlAttributeNode> attributes, Token attributeEnd, | 405 Token nodeStart, |
409 List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, | 406 Token tag, |
| 407 List<XmlAttributeNode> attributes, |
| 408 Token attributeEnd, |
| 409 List<XmlTagNode> tagNodes, |
| 410 Token contentEnd, |
| 411 Token closingTag, |
410 Token nodeEnd) { | 412 Token nodeEnd) { |
411 if (_isScriptNode(tag, attributes, tagNodes)) { | 413 if (_isScriptNode(tag, attributes, tagNodes)) { |
412 HtmlScriptTagNode tagNode = new HtmlScriptTagNode(nodeStart, tag, | 414 HtmlScriptTagNode tagNode = new HtmlScriptTagNode(nodeStart, tag, |
413 attributes, attributeEnd, tagNodes, contentEnd, closingTag, nodeEnd); | 415 attributes, attributeEnd, tagNodes, contentEnd, closingTag, nodeEnd); |
414 String contents = tagNode.content; | 416 String contents = tagNode.content; |
415 int contentOffset = attributeEnd.end; | 417 int contentOffset = attributeEnd.end; |
416 LineInfo_Location location = _lineInfo.getLocation(contentOffset); | 418 LineInfo_Location location = _lineInfo.getLocation(contentOffset); |
417 sc.Scanner scanner = new sc.Scanner(source, | 419 sc.Scanner scanner = new sc.Scanner(source, |
418 new sc.SubSequenceReader(contents, contentOffset), _errorListener); | 420 new sc.SubSequenceReader(contents, contentOffset), _errorListener); |
419 scanner.setSourceStart(location.lineNumber, location.columnNumber); | 421 scanner.setSourceStart(location.lineNumber, location.columnNumber); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 * | 527 * |
526 * @param nodeStart the token marking the beginning of the tag | 528 * @param nodeStart the token marking the beginning of the tag |
527 * @param tag the name of the tag | 529 * @param tag the name of the tag |
528 * @param attributes the attributes in the tag | 530 * @param attributes the attributes in the tag |
529 * @param attributeEnd the token terminating the region where attributes can b
e | 531 * @param attributeEnd the token terminating the region where attributes can b
e |
530 * @param tagNodes the children of the tag | 532 * @param tagNodes the children of the tag |
531 * @param contentEnd the token that starts the closing tag | 533 * @param contentEnd the token that starts the closing tag |
532 * @param closingTag the name of the tag that occurs in the closing tag | 534 * @param closingTag the name of the tag that occurs in the closing tag |
533 * @param nodeEnd the last token in the tag | 535 * @param nodeEnd the last token in the tag |
534 */ | 536 */ |
535 HtmlScriptTagNode(Token nodeStart, Token tag, | 537 HtmlScriptTagNode( |
536 List<XmlAttributeNode> attributes, Token attributeEnd, | 538 Token nodeStart, |
537 List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, | 539 Token tag, |
| 540 List<XmlAttributeNode> attributes, |
| 541 Token attributeEnd, |
| 542 List<XmlTagNode> tagNodes, |
| 543 Token contentEnd, |
| 544 Token closingTag, |
538 Token nodeEnd) | 545 Token nodeEnd) |
539 : super(nodeStart, tag, attributes, attributeEnd, tagNodes, contentEnd, | 546 : super(nodeStart, tag, attributes, attributeEnd, tagNodes, contentEnd, |
540 closingTag, nodeEnd); | 547 closingTag, nodeEnd); |
541 | 548 |
542 /** | 549 /** |
543 * Return the AST structure representing the Dart code within this tag, or `nu
ll` if this | 550 * Return the AST structure representing the Dart code within this tag, or `nu
ll` if this |
544 * tag references an external script. | 551 * tag references an external script. |
545 * | 552 * |
546 * @return the AST structure representing the Dart code within this tag | 553 * @return the AST structure representing the Dart code within this tag |
547 */ | 554 */ |
548 CompilationUnit get script => _script; | 555 CompilationUnit get script => _script; |
549 | 556 |
550 /** | 557 /** |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 /** | 1160 /** |
1154 * The reference to the [Element]. | 1161 * The reference to the [Element]. |
1155 */ | 1162 */ |
1156 class XmlExpression_Reference { | 1163 class XmlExpression_Reference { |
1157 Element element; | 1164 Element element; |
1158 | 1165 |
1159 int offset = 0; | 1166 int offset = 0; |
1160 | 1167 |
1161 int length = 0; | 1168 int length = 0; |
1162 | 1169 |
1163 XmlExpression_Reference(Element element, int offset, int length) { | 1170 XmlExpression_Reference(this.element, this.offset, this.length); |
1164 this.element = element; | |
1165 this.offset = offset; | |
1166 this.length = length; | |
1167 } | |
1168 } | 1171 } |
1169 | 1172 |
1170 /** | 1173 /** |
1171 * The abstract class `XmlNode` defines behavior common to all XML/HTML nodes. | 1174 * The abstract class `XmlNode` defines behavior common to all XML/HTML nodes. |
1172 */ | 1175 */ |
1173 abstract class XmlNode { | 1176 abstract class XmlNode { |
1174 /** | 1177 /** |
1175 * The parent of the node, or `null` if the node is the root of an AST structu
re. | 1178 * The parent of the node, or `null` if the node is the root of an AST structu
re. |
1176 */ | 1179 */ |
1177 XmlNode _parent; | 1180 XmlNode _parent; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 * @param nodeStart the token marking the beginning of the tag | 1424 * @param nodeStart the token marking the beginning of the tag |
1422 * @param tag the name of the tag | 1425 * @param tag the name of the tag |
1423 * @param attributes the attributes in the tag | 1426 * @param attributes the attributes in the tag |
1424 * @param attributeEnd the token terminating the region where attributes can b
e | 1427 * @param attributeEnd the token terminating the region where attributes can b
e |
1425 * @param tagNodes the children of the tag | 1428 * @param tagNodes the children of the tag |
1426 * @param contentEnd the token that starts the closing tag | 1429 * @param contentEnd the token that starts the closing tag |
1427 * @param closingTag the name of the tag that occurs in the closing tag | 1430 * @param closingTag the name of the tag that occurs in the closing tag |
1428 * @param nodeEnd the last token in the tag | 1431 * @param nodeEnd the last token in the tag |
1429 * @return the node that was created | 1432 * @return the node that was created |
1430 */ | 1433 */ |
1431 XmlTagNode createTagNode(Token nodeStart, Token tag, | 1434 XmlTagNode createTagNode( |
1432 List<XmlAttributeNode> attributes, Token attributeEnd, | 1435 Token nodeStart, |
1433 List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, | 1436 Token tag, |
1434 Token nodeEnd) => new XmlTagNode(nodeStart, tag, attributes, attributeEnd, | 1437 List<XmlAttributeNode> attributes, |
1435 tagNodes, contentEnd, closingTag, nodeEnd); | 1438 Token attributeEnd, |
| 1439 List<XmlTagNode> tagNodes, |
| 1440 Token contentEnd, |
| 1441 Token closingTag, |
| 1442 Token nodeEnd) => |
| 1443 new XmlTagNode(nodeStart, tag, attributes, attributeEnd, tagNodes, |
| 1444 contentEnd, closingTag, nodeEnd); |
1436 | 1445 |
1437 /** | 1446 /** |
1438 * Answer `true` if the specified tag is self closing and thus should never ha
ve content or | 1447 * Answer `true` if the specified tag is self closing and thus should never ha
ve content or |
1439 * child tag nodes. | 1448 * child tag nodes. |
1440 * | 1449 * |
1441 * @param tag the tag (not `null`) | 1450 * @param tag the tag (not `null`) |
1442 * @return `true` if self closing | 1451 * @return `true` if self closing |
1443 */ | 1452 */ |
1444 bool isSelfClosing(Token tag) => false; | 1453 bool isSelfClosing(Token tag) => false; |
1445 | 1454 |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 * * (2) the [TokenType.LT] nodeStart of the next sibling node if thi
s node is | 1745 * * (2) the [TokenType.LT] nodeStart of the next sibling node if thi
s node is |
1737 * self closing or the attributeEnd is [TokenType.SLASH_GT], or | 1746 * self closing or the attributeEnd is [TokenType.SLASH_GT], or |
1738 * * (3) [TokenType.EOF] if the node does not have a closing tag and
is the last | 1747 * * (3) [TokenType.EOF] if the node does not have a closing tag and
is the last |
1739 * node in the stream [TokenType.LT_SLASH] token after the content, o
r `null` | 1748 * node in the stream [TokenType.LT_SLASH] token after the content, o
r `null` |
1740 * if there is no content and the attributes ended with [TokenType.SL
ASH_GT]. | 1749 * if there is no content and the attributes ended with [TokenType.SL
ASH_GT]. |
1741 * @param closingTag the closing [TokenType.TAG] after the child elements or `
null` if | 1750 * @param closingTag the closing [TokenType.TAG] after the child elements or `
null` if |
1742 * there is no content and the attributes ended with [TokenType.SLASH
_GT] | 1751 * there is no content and the attributes ended with [TokenType.SLASH
_GT] |
1743 * @param nodeEnd the ending [TokenType.GT] or [TokenType.SLASH_GT] token (not | 1752 * @param nodeEnd the ending [TokenType.GT] or [TokenType.SLASH_GT] token (not |
1744 * `null`) | 1753 * `null`) |
1745 */ | 1754 */ |
1746 XmlTagNode(this.nodeStart, this._tag, List<XmlAttributeNode> attributes, | 1755 XmlTagNode( |
1747 this.attributeEnd, List<XmlTagNode> tagNodes, this.contentEnd, | 1756 this.nodeStart, |
1748 this.closingTag, this.nodeEnd) { | 1757 this._tag, |
| 1758 List<XmlAttributeNode> attributes, |
| 1759 this.attributeEnd, |
| 1760 List<XmlTagNode> tagNodes, |
| 1761 this.contentEnd, |
| 1762 this.closingTag, |
| 1763 this.nodeEnd) { |
1749 this._attributes = becomeParentOfAll(attributes, ifEmpty: NO_ATTRIBUTES); | 1764 this._attributes = becomeParentOfAll(attributes, ifEmpty: NO_ATTRIBUTES); |
1750 this._tagNodes = becomeParentOfAll(tagNodes, ifEmpty: NO_TAG_NODES); | 1765 this._tagNodes = becomeParentOfAll(tagNodes, ifEmpty: NO_TAG_NODES); |
1751 } | 1766 } |
1752 | 1767 |
1753 /** | 1768 /** |
1754 * Answer the receiver's attributes. Callers should not manipulate the returne
d list to edit the | 1769 * Answer the receiver's attributes. Callers should not manipulate the returne
d list to edit the |
1755 * AST structure. | 1770 * AST structure. |
1756 * | 1771 * |
1757 * @return the attributes (not `null`, contains no `null`s) | 1772 * @return the attributes (not `null`, contains no `null`s) |
1758 */ | 1773 */ |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 */ | 1896 */ |
1882 abstract class XmlVisitor<R> { | 1897 abstract class XmlVisitor<R> { |
1883 R visitHtmlScriptTagNode(HtmlScriptTagNode node); | 1898 R visitHtmlScriptTagNode(HtmlScriptTagNode node); |
1884 | 1899 |
1885 R visitHtmlUnit(HtmlUnit htmlUnit); | 1900 R visitHtmlUnit(HtmlUnit htmlUnit); |
1886 | 1901 |
1887 R visitXmlAttributeNode(XmlAttributeNode xmlAttributeNode); | 1902 R visitXmlAttributeNode(XmlAttributeNode xmlAttributeNode); |
1888 | 1903 |
1889 R visitXmlTagNode(XmlTagNode xmlTagNode); | 1904 R visitXmlTagNode(XmlTagNode xmlTagNode); |
1890 } | 1905 } |
OLD | NEW |