| 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 | 3 |
| 4 library engine.html; | 4 library engine.html; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'java_core.dart'; | 7 import 'java_core.dart'; |
| 8 import 'java_engine.dart'; | 8 import 'java_engine.dart'; |
| 9 import 'source.dart'; | 9 import 'source.dart'; |
| 10 import 'error.dart'; | 10 import 'error.dart'; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 _jtd_constructor_150_impl(TokenType type, int offset) { | 48 _jtd_constructor_150_impl(TokenType type, int offset) { |
| 49 _jtd_constructor_151_impl(type, offset, type.lexeme); | 49 _jtd_constructor_151_impl(type, offset, type.lexeme); |
| 50 } | 50 } |
| 51 /** | 51 /** |
| 52 * Initialize a newly created token. | 52 * Initialize a newly created token. |
| 53 * @param type the token type (not {@code null}) | 53 * @param type the token type (not {@code null}) |
| 54 * @param offset the offset from the beginning of the file to the first charac
ter in the token | 54 * @param offset the offset from the beginning of the file to the first charac
ter in the token |
| 55 * @param value the lexeme represented by this token (not {@code null}) | 55 * @param value the lexeme represented by this token (not {@code null}) |
| 56 */ | 56 */ |
| 57 Token.con2(TokenType type4, int offset3, String value7) { | 57 Token.con2(TokenType type2, int offset2, String value2) { |
| 58 _jtd_constructor_151_impl(type4, offset3, value7); | 58 _jtd_constructor_151_impl(type2, offset2, value2); |
| 59 } | 59 } |
| 60 _jtd_constructor_151_impl(TokenType type4, int offset3, String value7) { | 60 _jtd_constructor_151_impl(TokenType type2, int offset2, String value2) { |
| 61 this._type = type4; | 61 this._type = type2; |
| 62 this._value = StringUtilities.intern(value7); | 62 this._value = StringUtilities.intern(value2); |
| 63 this._offset = offset3; | 63 this._offset = offset2; |
| 64 } | 64 } |
| 65 /** | 65 /** |
| 66 * Return the offset from the beginning of the file to the character after las
t character of the | 66 * Return the offset from the beginning of the file to the character after las
t character of the |
| 67 * token. | 67 * token. |
| 68 * @return the offset from the beginning of the file to the first character af
ter last character | 68 * @return the offset from the beginning of the file to the first character af
ter last character |
| 69 * of the token | 69 * of the token |
| 70 */ | 70 */ |
| 71 int get end => _offset + length; | 71 int get end => _offset + length; |
| 72 /** | 72 /** |
| 73 * Return the number of characters in the node's source range. | 73 * Return the number of characters in the node's source range. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 /** | 198 /** |
| 199 * Return the last token included in this node's source range. | 199 * Return the last token included in this node's source range. |
| 200 * @return the last token or {@code null} if none | 200 * @return the last token or {@code null} if none |
| 201 */ | 201 */ |
| 202 Token get endToken; | 202 Token get endToken; |
| 203 /** | 203 /** |
| 204 * Return the number of characters in the node's source range. | 204 * Return the number of characters in the node's source range. |
| 205 * @return the number of characters in the node's source range | 205 * @return the number of characters in the node's source range |
| 206 */ | 206 */ |
| 207 int get length { | 207 int get length { |
| 208 Token beginToken4 = beginToken; | 208 Token beginToken2 = beginToken; |
| 209 Token endToken4 = endToken; | 209 Token endToken2 = endToken; |
| 210 if (beginToken4 == null || endToken4 == null) { | 210 if (beginToken2 == null || endToken2 == null) { |
| 211 return -1; | 211 return -1; |
| 212 } | 212 } |
| 213 return endToken4.offset + endToken4.length - beginToken4.offset; | 213 return endToken2.offset + endToken2.length - beginToken2.offset; |
| 214 } | 214 } |
| 215 /** | 215 /** |
| 216 * Return the offset from the beginning of the file to the first character in
the node's source | 216 * Return the offset from the beginning of the file to the first character in
the node's source |
| 217 * range. | 217 * range. |
| 218 * @return the offset from the beginning of the file to the first character in
the node's source | 218 * @return the offset from the beginning of the file to the first character in
the node's source |
| 219 * range | 219 * range |
| 220 */ | 220 */ |
| 221 int get offset { | 221 int get offset { |
| 222 Token beginToken5 = beginToken; | 222 Token beginToken2 = beginToken; |
| 223 if (beginToken5 == null) { | 223 if (beginToken2 == null) { |
| 224 return -1; | 224 return -1; |
| 225 } | 225 } |
| 226 return beginToken.offset; | 226 return beginToken.offset; |
| 227 } | 227 } |
| 228 /** | 228 /** |
| 229 * Return this node's parent node, or {@code null} if this node is the root of
an AST structure. | 229 * Return this node's parent node, or {@code null} if this node is the root of
an AST structure. |
| 230 * <p> | 230 * <p> |
| 231 * Note that the relationship between an AST node and its parent node may chan
ge over the lifetime | 231 * Note that the relationship between an AST node and its parent node may chan
ge over the lifetime |
| 232 * of a node. | 232 * of a node. |
| 233 * @return the parent of this node, or {@code null} if none | 233 * @return the parent of this node, or {@code null} if none |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 * Initialize a newly created scanner to scan the characters in the given stri
ng. | 609 * Initialize a newly created scanner to scan the characters in the given stri
ng. |
| 610 * @param source the source being scanned | 610 * @param source the source being scanned |
| 611 * @param string the string from which characters will be read | 611 * @param string the string from which characters will be read |
| 612 */ | 612 */ |
| 613 StringScanner(Source source, String string) : super(source) { | 613 StringScanner(Source source, String string) : super(source) { |
| 614 this._string = string; | 614 this._string = string; |
| 615 this._stringLength = string.length; | 615 this._stringLength = string.length; |
| 616 this._charOffset = -1; | 616 this._charOffset = -1; |
| 617 } | 617 } |
| 618 int get offset => _charOffset; | 618 int get offset => _charOffset; |
| 619 void set offset(int offset12) { | 619 void set offset(int offset2) { |
| 620 _charOffset = offset12; | 620 _charOffset = offset2; |
| 621 } | 621 } |
| 622 int advance() { | 622 int advance() { |
| 623 if (++_charOffset < _stringLength) { | 623 if (++_charOffset < _stringLength) { |
| 624 return _string.codeUnitAt(_charOffset); | 624 return _string.codeUnitAt(_charOffset); |
| 625 } | 625 } |
| 626 _charOffset = _stringLength; | 626 _charOffset = _stringLength; |
| 627 return -1; | 627 return -1; |
| 628 } | 628 } |
| 629 String getString(int start, int endDelta) => _string.substring(start, _charOff
set + 1 + endDelta); | 629 String getString(int start, int endDelta) => _string.substring(start, _charOff
set + 1 + endDelta); |
| 630 int peek() { | 630 int peek() { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 ToSourceVisitor(PrintWriter writer) { | 696 ToSourceVisitor(PrintWriter writer) { |
| 697 this._writer = writer; | 697 this._writer = writer; |
| 698 } | 698 } |
| 699 Object visitHtmlUnit(HtmlUnit node) { | 699 Object visitHtmlUnit(HtmlUnit node) { |
| 700 for (XmlTagNode child in node.tagNodes) { | 700 for (XmlTagNode child in node.tagNodes) { |
| 701 visit(child); | 701 visit(child); |
| 702 } | 702 } |
| 703 return null; | 703 return null; |
| 704 } | 704 } |
| 705 Object visitXmlAttributeNode(XmlAttributeNode node) { | 705 Object visitXmlAttributeNode(XmlAttributeNode node) { |
| 706 String name11 = node.name.lexeme; | 706 String name2 = node.name.lexeme; |
| 707 Token value9 = node.value; | 707 Token value2 = node.value; |
| 708 if (name11.length == 0) { | 708 if (name2.length == 0) { |
| 709 _writer.print("__"); | 709 _writer.print("__"); |
| 710 } else { | 710 } else { |
| 711 _writer.print(name11); | 711 _writer.print(name2); |
| 712 } | 712 } |
| 713 _writer.print("="); | 713 _writer.print("="); |
| 714 if (value9 == null) { | 714 if (value2 == null) { |
| 715 _writer.print("__"); | 715 _writer.print("__"); |
| 716 } else { | 716 } else { |
| 717 _writer.print(value9.lexeme); | 717 _writer.print(value2.lexeme); |
| 718 } | 718 } |
| 719 return null; | 719 return null; |
| 720 } | 720 } |
| 721 Object visitXmlTagNode(XmlTagNode node) { | 721 Object visitXmlTagNode(XmlTagNode node) { |
| 722 _writer.print("<"); | 722 _writer.print("<"); |
| 723 String tagName = node.tag.lexeme; | 723 String tagName = node.tag.lexeme; |
| 724 _writer.print(tagName); | 724 _writer.print(tagName); |
| 725 for (XmlAttributeNode attribute in node.attributes) { | 725 for (XmlAttributeNode attribute in node.attributes) { |
| 726 _writer.print(" "); | 726 _writer.print(" "); |
| 727 visit(attribute); | 727 visit(attribute); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 */ | 905 */ |
| 906 HtmlScanner(Source source) { | 906 HtmlScanner(Source source) { |
| 907 this._source = source; | 907 this._source = source; |
| 908 } | 908 } |
| 909 void accept(CharBuffer contents, int modificationTime2) { | 909 void accept(CharBuffer contents, int modificationTime2) { |
| 910 this._modificationTime = modificationTime2; | 910 this._modificationTime = modificationTime2; |
| 911 _scanner = new CharBufferScanner(_source, contents); | 911 _scanner = new CharBufferScanner(_source, contents); |
| 912 _scanner.passThroughElements = _SCRIPT_TAG; | 912 _scanner.passThroughElements = _SCRIPT_TAG; |
| 913 _token = _scanner.tokenize(); | 913 _token = _scanner.tokenize(); |
| 914 } | 914 } |
| 915 void accept2(String contents, int modificationTime3) { | 915 void accept2(String contents, int modificationTime2) { |
| 916 this._modificationTime = modificationTime3; | 916 this._modificationTime = modificationTime2; |
| 917 _scanner = new StringScanner(_source, contents); | 917 _scanner = new StringScanner(_source, contents); |
| 918 _scanner.passThroughElements = _SCRIPT_TAG; | 918 _scanner.passThroughElements = _SCRIPT_TAG; |
| 919 _token = _scanner.tokenize(); | 919 _token = _scanner.tokenize(); |
| 920 } | 920 } |
| 921 /** | 921 /** |
| 922 * Answer the result of scanning the source | 922 * Answer the result of scanning the source |
| 923 * @return the result (not {@code null}) | 923 * @return the result (not {@code null}) |
| 924 */ | 924 */ |
| 925 HtmlScanResult get result => new HtmlScanResult(_modificationTime, _token, _sc
anner.lineStarts); | 925 HtmlScanResult get result => new HtmlScanResult(_modificationTime, _token, _sc
anner.lineStarts); |
| 926 } | 926 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 value = insertSyntheticToken(TokenType.STRING); | 1022 value = insertSyntheticToken(TokenType.STRING); |
| 1023 } | 1023 } |
| 1024 return new XmlAttributeNode(name, equals, value); | 1024 return new XmlAttributeNode(name, equals, value); |
| 1025 } | 1025 } |
| 1026 /** | 1026 /** |
| 1027 * Parse the stream for a sequence of attributes. This method advances the cur
rent token to the | 1027 * Parse the stream for a sequence of attributes. This method advances the cur
rent token to the |
| 1028 * next {@link TokenType#GT}, {@link TokenType#SLASH_GT}, or {@link TokenType#
EOF}. | 1028 * next {@link TokenType#GT}, {@link TokenType#SLASH_GT}, or {@link TokenType#
EOF}. |
| 1029 * @return a collection of zero or more attributes (not {@code null}, contains
no {@code null}s) | 1029 * @return a collection of zero or more attributes (not {@code null}, contains
no {@code null}s) |
| 1030 */ | 1030 */ |
| 1031 List<XmlAttributeNode> parseAttributes() { | 1031 List<XmlAttributeNode> parseAttributes() { |
| 1032 TokenType type11 = _currentToken.type; | 1032 TokenType type2 = _currentToken.type; |
| 1033 if (identical(type11, TokenType.GT) || identical(type11, TokenType.SLASH_GT)
|| identical(type11, TokenType.EOF)) { | 1033 if (identical(type2, TokenType.GT) || identical(type2, TokenType.SLASH_GT) |
| identical(type2, TokenType.EOF)) { |
| 1034 return XmlTagNode.NO_ATTRIBUTES; | 1034 return XmlTagNode.NO_ATTRIBUTES; |
| 1035 } | 1035 } |
| 1036 List<XmlAttributeNode> attributes = new List<XmlAttributeNode>(); | 1036 List<XmlAttributeNode> attributes = new List<XmlAttributeNode>(); |
| 1037 while (true) { | 1037 while (true) { |
| 1038 while (true) { | 1038 while (true) { |
| 1039 if (_currentToken.type == TokenType.GT || _currentToken.type == TokenTyp
e.SLASH_GT || _currentToken.type == TokenType.EOF) { | 1039 if (_currentToken.type == TokenType.GT || _currentToken.type == TokenTyp
e.SLASH_GT || _currentToken.type == TokenType.EOF) { |
| 1040 return attributes; | 1040 return attributes; |
| 1041 } else if (_currentToken.type == TokenType.TAG) { | 1041 } else if (_currentToken.type == TokenType.TAG) { |
| 1042 attributes.add(parseAttribute()); | 1042 attributes.add(parseAttribute()); |
| 1043 } else { | 1043 } else { |
| 1044 reportUnexpectedToken(); | 1044 reportUnexpectedToken(); |
| 1045 _currentToken = _currentToken.next; | 1045 _currentToken = _currentToken.next; |
| 1046 } | 1046 } |
| 1047 break; | 1047 break; |
| 1048 } | 1048 } |
| 1049 } | 1049 } |
| 1050 } | 1050 } |
| 1051 /** | 1051 /** |
| 1052 * Parse the stream for a sequence of tag nodes existing within a parent tag n
ode. This method | 1052 * Parse the stream for a sequence of tag nodes existing within a parent tag n
ode. This method |
| 1053 * advances the current token to the next {@link TokenType#LT_SLASH} or {@link
TokenType#EOF}. | 1053 * advances the current token to the next {@link TokenType#LT_SLASH} or {@link
TokenType#EOF}. |
| 1054 * @return a list of nodes (not {@code null}, contains no {@code null}s) | 1054 * @return a list of nodes (not {@code null}, contains no {@code null}s) |
| 1055 */ | 1055 */ |
| 1056 List<XmlTagNode> parseChildTagNodes() { | 1056 List<XmlTagNode> parseChildTagNodes() { |
| 1057 TokenType type12 = _currentToken.type; | 1057 TokenType type2 = _currentToken.type; |
| 1058 if (identical(type12, TokenType.LT_SLASH) || identical(type12, TokenType.EOF
)) { | 1058 if (identical(type2, TokenType.LT_SLASH) || identical(type2, TokenType.EOF))
{ |
| 1059 return XmlTagNode.NO_TAG_NODES; | 1059 return XmlTagNode.NO_TAG_NODES; |
| 1060 } | 1060 } |
| 1061 List<XmlTagNode> nodes = new List<XmlTagNode>(); | 1061 List<XmlTagNode> nodes = new List<XmlTagNode>(); |
| 1062 while (true) { | 1062 while (true) { |
| 1063 while (true) { | 1063 while (true) { |
| 1064 if (_currentToken.type == TokenType.LT) { | 1064 if (_currentToken.type == TokenType.LT) { |
| 1065 nodes.add(parseTagNode()); | 1065 nodes.add(parseTagNode()); |
| 1066 } else if (_currentToken.type == TokenType.LT_SLASH || _currentToken.typ
e == TokenType.EOF) { | 1066 } else if (_currentToken.type == TokenType.LT_SLASH || _currentToken.typ
e == TokenType.EOF) { |
| 1067 return nodes; | 1067 return nodes; |
| 1068 } else if (_currentToken.type == TokenType.COMMENT) { | 1068 } else if (_currentToken.type == TokenType.COMMENT) { |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 /** | 1417 /** |
| 1418 * Answer the tag nodes contained in the receiver. Callers should not manipula
te the returned list | 1418 * Answer the tag nodes contained in the receiver. Callers should not manipula
te the returned list |
| 1419 * to edit the AST structure. | 1419 * to edit the AST structure. |
| 1420 * @return the children (not {@code null}, contains no {@code null}s) | 1420 * @return the children (not {@code null}, contains no {@code null}s) |
| 1421 */ | 1421 */ |
| 1422 List<XmlTagNode> get tagNodes => _tagNodes; | 1422 List<XmlTagNode> get tagNodes => _tagNodes; |
| 1423 /** | 1423 /** |
| 1424 * Set the element associated with this HTML unit. | 1424 * Set the element associated with this HTML unit. |
| 1425 * @param element the element | 1425 * @param element the element |
| 1426 */ | 1426 */ |
| 1427 void set element(HtmlElementImpl element18) { | 1427 void set element(HtmlElementImpl element2) { |
| 1428 this._element = element18; | 1428 this._element = element2; |
| 1429 } | 1429 } |
| 1430 void visitChildren(XmlVisitor<Object> visitor) { | 1430 void visitChildren(XmlVisitor<Object> visitor) { |
| 1431 for (XmlTagNode node in _tagNodes) { | 1431 for (XmlTagNode node in _tagNodes) { |
| 1432 node.accept(visitor); | 1432 node.accept(visitor); |
| 1433 } | 1433 } |
| 1434 } | 1434 } |
| 1435 } | 1435 } |
| OLD | NEW |