Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(797)

Side by Side Diff: pkg/analyzer/lib/src/generated/html.dart

Issue 214593008: Rollback pkg/analyzer that breaks code_transformers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/lib/src/generated/index.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 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. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.html; 8 library engine.html;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
11 import 'java_core.dart'; 11 import 'java_core.dart';
12 import 'java_engine.dart'; 12 import 'java_engine.dart';
13 import 'source.dart'; 13 import 'source.dart';
14 import 'error.dart' show AnalysisErrorListener; 14 import 'error.dart' show AnalysisErrorListener;
15 import 'scanner.dart' as sc show Scanner, SubSequenceReader, Token; 15 import 'scanner.dart' as sc show Scanner, SubSequenceReader, Token;
16 import 'parser.dart' show Parser; 16 import 'parser.dart' show Parser;
17 import 'ast.dart'; 17 import 'ast.dart';
18 import 'element.dart'; 18 import 'element.dart';
19 import 'engine.dart' show AnalysisEngine, AngularHtmlUnitResolver, ExpressionVis itor; 19 import 'engine.dart' show AnalysisEngine, AngularHtmlUnitResolver, ExpressionVis itor;
20 20
21 /** 21 /**
22 * Instances of the class `Token` represent a token that was scanned from the in put. Each 22 * Instances of the class `Token` represent a token that was scanned from the in put. Each
23 * token knows which token follows it, acting as the head of a linked list of to kens. 23 * token knows which token follows it, acting as the head of a linked list of to kens.
24 */ 24 */
25 class Token { 25 class Token {
26 /** 26 /**
27 * The offset from the beginning of the file to the first character in the tok en. 27 * The offset from the beginning of the file to the first character in the tok en.
28 */ 28 */
29 final int offset; 29 int _offset = 0;
30 30
31 /** 31 /**
32 * The previous token in the token stream. 32 * The previous token in the token stream.
33 */ 33 */
34 Token previous; 34 Token previous;
35 35
36 /** 36 /**
37 * The next token in the token stream. 37 * The next token in the token stream.
38 */ 38 */
39 Token _next; 39 Token _next;
40 40
41 /** 41 /**
42 * The type of the token. 42 * The type of the token.
43 */ 43 */
44 final TokenType type; 44 TokenType _type;
45 45
46 /** 46 /**
47 * The lexeme represented by this token. 47 * The lexeme represented by this token.
48 */ 48 */
49 String _value; 49 String _value;
50 50
51 /** 51 /**
52 * Initialize a newly created token. 52 * Initialize a newly created token.
53 * 53 *
54 * @param type the token type (not `null`) 54 * @param type the token type (not `null`)
55 * @param offset the offset from the beginning of the file to the first charac ter in the token 55 * @param offset the offset from the beginning of the file to the first charac ter in the token
56 */ 56 */
57 Token.con1(TokenType type, int offset) : this.con2(type, offset, type.lexeme); 57 Token.con1(TokenType type, int offset) : this.con2(type, offset, type.lexeme);
58 58
59 /** 59 /**
60 * Initialize a newly created token. 60 * Initialize a newly created token.
61 * 61 *
62 * @param type the token type (not `null`) 62 * @param type the token type (not `null`)
63 * @param offset the offset from the beginning of the file to the first charac ter in the token 63 * @param offset the offset from the beginning of the file to the first charac ter in the token
64 * @param value the lexeme represented by this token (not `null`) 64 * @param value the lexeme represented by this token (not `null`)
65 */ 65 */
66 Token.con2(this.type, this.offset, String value) { 66 Token.con2(TokenType type, int offset, String value) {
67 this._type = type;
67 this._value = StringUtilities.intern(value); 68 this._value = StringUtilities.intern(value);
69 this._offset = offset;
68 } 70 }
69 71
70 /** 72 /**
71 * Return the offset from the beginning of the file to the character after las t character of the 73 * Return the offset from the beginning of the file to the character after las t character of the
72 * token. 74 * token.
73 * 75 *
74 * @return the offset from the beginning of the file to the first character af ter last character 76 * @return the offset from the beginning of the file to the first character af ter last character
75 * of the token 77 * of the token
76 */ 78 */
77 int get end => offset + length; 79 int get end => _offset + length;
78 80
79 /** 81 /**
80 * Return the number of characters in the node's source range. 82 * Return the number of characters in the node's source range.
81 * 83 *
82 * @return the number of characters in the node's source range 84 * @return the number of characters in the node's source range
83 */ 85 */
84 int get length => lexeme.length; 86 int get length => lexeme.length;
85 87
86 /** 88 /**
87 * Return the lexeme that represents this token. 89 * Return the lexeme that represents this token.
88 * 90 *
89 * @return the lexeme (not `null`) 91 * @return the lexeme (not `null`)
90 */ 92 */
91 String get lexeme => _value; 93 String get lexeme => _value;
92 94
93 /** 95 /**
94 * Return the next token in the token stream. 96 * Return the next token in the token stream.
95 * 97 *
96 * @return the next token in the token stream 98 * @return the next token in the token stream
97 */ 99 */
98 Token get next => _next; 100 Token get next => _next;
99 101
100 /** 102 /**
103 * Return the offset from the beginning of the file to the first character in the token.
104 *
105 * @return the offset from the beginning of the file to the first character in the token
106 */
107 int get offset => _offset;
108
109 /**
110 * Answer the token type for the receiver.
111 *
112 * @return the token type (not `null`)
113 */
114 TokenType get type => _type;
115
116 /**
101 * Return `true` if this token is a synthetic token. A synthetic token is a to ken that was 117 * Return `true` if this token is a synthetic token. A synthetic token is a to ken that was
102 * introduced by the parser in order to recover from an error in the code. Syn thetic tokens always 118 * introduced by the parser in order to recover from an error in the code. Syn thetic tokens always
103 * have a length of zero (`0`). 119 * have a length of zero (`0`).
104 * 120 *
105 * @return `true` if this token is a synthetic token 121 * @return `true` if this token is a synthetic token
106 */ 122 */
107 bool get isSynthetic => length == 0; 123 bool get isSynthetic => length == 0;
108 124
109 /** 125 /**
110 * Set the next token in the token stream to the given token. This has the sid e-effect of setting 126 * Set the next token in the token stream to the given token. This has the sid e-effect of setting
(...skipping 10 matching lines...) Expand all
121 137
122 @override 138 @override
123 String toString() => lexeme; 139 String toString() => lexeme;
124 } 140 }
125 141
126 /** 142 /**
127 * Implementation of [XmlExpression] for an [Expression] embedded without any wr apping 143 * Implementation of [XmlExpression] for an [Expression] embedded without any wr apping
128 * characters. 144 * characters.
129 */ 145 */
130 class RawXmlExpression extends XmlExpression { 146 class RawXmlExpression extends XmlExpression {
131 final Expression expression; 147 Expression expression;
132 148
133 RawXmlExpression(this.expression); 149 RawXmlExpression(Expression expression) {
150 this.expression = expression;
151 }
134 152
135 @override 153 @override
136 int get end => expression.end; 154 int get end => expression.end;
137 155
138 @override 156 @override
139 int get length => expression.length; 157 int get length => expression.length;
140 158
141 @override 159 @override
142 int get offset => expression.offset; 160 int get offset => expression.offset;
143 161
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 /** 677 /**
660 * The abstract class `AbstractScanner` implements a scanner for HTML code. Subc lasses are 678 * The abstract class `AbstractScanner` implements a scanner for HTML code. Subc lasses are
661 * required to implement the interface used to access the characters being scann ed. 679 * required to implement the interface used to access the characters being scann ed.
662 */ 680 */
663 abstract class AbstractScanner { 681 abstract class AbstractScanner {
664 static List<String> _NO_PASS_THROUGH_ELEMENTS = <String> []; 682 static List<String> _NO_PASS_THROUGH_ELEMENTS = <String> [];
665 683
666 /** 684 /**
667 * The source being scanned. 685 * The source being scanned.
668 */ 686 */
669 final Source source; 687 Source source;
670 688
671 /** 689 /**
672 * The token pointing to the head of the linked list of tokens. 690 * The token pointing to the head of the linked list of tokens.
673 */ 691 */
674 Token _tokens; 692 Token _tokens;
675 693
676 /** 694 /**
677 * The last token that was scanned. 695 * The last token that was scanned.
678 */ 696 */
679 Token _tail; 697 Token _tail;
680 698
681 /** 699 /**
682 * A list containing the offsets of the first character of each line in the so urce code. 700 * A list containing the offsets of the first character of each line in the so urce code.
683 */ 701 */
684 List<int> _lineStarts = new List<int>(); 702 List<int> _lineStarts = new List<int>();
685 703
686 /** 704 /**
687 * An array of element tags for which the content between tags should be consi der a single token. 705 * An array of element tags for which the content between tags should be consi der a single token.
688 */ 706 */
689 List<String> _passThroughElements = _NO_PASS_THROUGH_ELEMENTS; 707 List<String> _passThroughElements = _NO_PASS_THROUGH_ELEMENTS;
690 708
691 /** 709 /**
692 * Initialize a newly created scanner. 710 * Initialize a newly created scanner.
693 * 711 *
694 * @param source the source being scanned 712 * @param source the source being scanned
695 */ 713 */
696 AbstractScanner(this.source) { 714 AbstractScanner(Source source) {
715 this.source = source;
697 _tokens = new Token.con1(TokenType.EOF, -1); 716 _tokens = new Token.con1(TokenType.EOF, -1);
698 _tokens.setNext(_tokens); 717 _tokens.setNext(_tokens);
699 _tail = _tokens; 718 _tail = _tokens;
700 recordStartOfLine(); 719 recordStartOfLine();
701 } 720 }
702 721
703 /** 722 /**
704 * Return an array containing the offsets of the first character of each line in the source code. 723 * Return an array containing the offsets of the first character of each line in the source code.
705 * 724 *
706 * @return an array containing the offsets of the first character of each line in the source code 725 * @return an array containing the offsets of the first character of each line in the source code
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 } 995 }
977 996
978 /** 997 /**
979 * Instances of the class `StringScanner` implement a scanner that reads from a string. The 998 * Instances of the class `StringScanner` implement a scanner that reads from a string. The
980 * scanning logic is in the superclass. 999 * scanning logic is in the superclass.
981 */ 1000 */
982 class StringScanner extends AbstractScanner { 1001 class StringScanner extends AbstractScanner {
983 /** 1002 /**
984 * The string from which characters will be read. 1003 * The string from which characters will be read.
985 */ 1004 */
986 final String _string; 1005 String _string;
987 1006
988 /** 1007 /**
989 * The number of characters in the string. 1008 * The number of characters in the string.
990 */ 1009 */
991 int _stringLength = 0; 1010 int _stringLength = 0;
992 1011
993 /** 1012 /**
994 * The index, relative to the string, of the last character that was read. 1013 * The index, relative to the string, of the last character that was read.
995 */ 1014 */
996 int _charOffset = 0; 1015 int _charOffset = 0;
997 1016
998 /** 1017 /**
999 * Initialize a newly created scanner to scan the characters in the given stri ng. 1018 * Initialize a newly created scanner to scan the characters in the given stri ng.
1000 * 1019 *
1001 * @param source the source being scanned 1020 * @param source the source being scanned
1002 * @param string the string from which characters will be read 1021 * @param string the string from which characters will be read
1003 */ 1022 */
1004 StringScanner(Source source, this._string) : super(source) { 1023 StringScanner(Source source, String string) : super(source) {
1005 this._stringLength = _string.length; 1024 this._string = string;
1025 this._stringLength = string.length;
1006 this._charOffset = -1; 1026 this._charOffset = -1;
1007 } 1027 }
1008 1028
1009 @override 1029 @override
1010 int get offset => _charOffset; 1030 int get offset => _charOffset;
1011 1031
1012 void set offset(int offset) { 1032 void set offset(int offset) {
1013 _charOffset = offset; 1033 _charOffset = offset;
1014 } 1034 }
1015 1035
(...skipping 19 matching lines...) Expand all
1035 } 1055 }
1036 1056
1037 /** 1057 /**
1038 * Instances of the class `ToSourceVisitor` write a source representation of a v isited XML 1058 * Instances of the class `ToSourceVisitor` write a source representation of a v isited XML
1039 * node (and all of it's children) to a writer. 1059 * node (and all of it's children) to a writer.
1040 */ 1060 */
1041 class ToSourceVisitor implements XmlVisitor<Object> { 1061 class ToSourceVisitor implements XmlVisitor<Object> {
1042 /** 1062 /**
1043 * The writer to which the source is to be written. 1063 * The writer to which the source is to be written.
1044 */ 1064 */
1045 final PrintWriter _writer; 1065 PrintWriter _writer;
1046 1066
1047 /** 1067 /**
1048 * Initialize a newly created visitor to write source code representing the vi sited nodes to the 1068 * Initialize a newly created visitor to write source code representing the vi sited nodes to the
1049 * given writer. 1069 * given writer.
1050 * 1070 *
1051 * @param writer the writer to which the source is to be written 1071 * @param writer the writer to which the source is to be written
1052 */ 1072 */
1053 ToSourceVisitor(this._writer); 1073 ToSourceVisitor(PrintWriter writer) {
1074 this._writer = writer;
1075 }
1054 1076
1055 @override 1077 @override
1056 Object visitHtmlScriptTagNode(HtmlScriptTagNode node) => visitXmlTagNode(node) ; 1078 Object visitHtmlScriptTagNode(HtmlScriptTagNode node) => visitXmlTagNode(node) ;
1057 1079
1058 @override 1080 @override
1059 Object visitHtmlUnit(HtmlUnit node) { 1081 Object visitHtmlUnit(HtmlUnit node) {
1060 for (XmlTagNode child in node.tagNodes) { 1082 for (XmlTagNode child in node.tagNodes) {
1061 _visit(child); 1083 _visit(child);
1062 } 1084 }
1063 return null; 1085 return null;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 } 1137 }
1116 1138
1117 /** 1139 /**
1118 * The enumeration `TokenType` defines the types of tokens that can be returned by the 1140 * The enumeration `TokenType` defines the types of tokens that can be returned by the
1119 * scanner. 1141 * scanner.
1120 */ 1142 */
1121 class TokenType extends Enum<TokenType> { 1143 class TokenType extends Enum<TokenType> {
1122 /** 1144 /**
1123 * The type of the token that marks the end of the input. 1145 * The type of the token that marks the end of the input.
1124 */ 1146 */
1125 static const TokenType EOF = const TokenType_EOF('EOF', 0, ""); 1147 static final TokenType EOF = new TokenType_EOF('EOF', 0, "");
1126 1148
1127 static const TokenType EQ = const TokenType('EQ', 1, "="); 1149 static final TokenType EQ = new TokenType('EQ', 1, "=");
1128 1150
1129 static const TokenType GT = const TokenType('GT', 2, ">"); 1151 static final TokenType GT = new TokenType('GT', 2, ">");
1130 1152
1131 static const TokenType LT_SLASH = const TokenType('LT_SLASH', 3, "</"); 1153 static final TokenType LT_SLASH = new TokenType('LT_SLASH', 3, "</");
1132 1154
1133 static const TokenType LT = const TokenType('LT', 4, "<"); 1155 static final TokenType LT = new TokenType('LT', 4, "<");
1134 1156
1135 static const TokenType SLASH_GT = const TokenType('SLASH_GT', 5, "/>"); 1157 static final TokenType SLASH_GT = new TokenType('SLASH_GT', 5, "/>");
1136 1158
1137 static const TokenType COMMENT = const TokenType('COMMENT', 6, null); 1159 static final TokenType COMMENT = new TokenType('COMMENT', 6, null);
1138 1160
1139 static const TokenType DECLARATION = const TokenType('DECLARATION', 7, null); 1161 static final TokenType DECLARATION = new TokenType('DECLARATION', 7, null);
1140 1162
1141 static const TokenType DIRECTIVE = const TokenType('DIRECTIVE', 8, null); 1163 static final TokenType DIRECTIVE = new TokenType('DIRECTIVE', 8, null);
1142 1164
1143 static const TokenType STRING = const TokenType('STRING', 9, null); 1165 static final TokenType STRING = new TokenType('STRING', 9, null);
1144 1166
1145 static const TokenType TAG = const TokenType('TAG', 10, null); 1167 static final TokenType TAG = new TokenType('TAG', 10, null);
1146 1168
1147 static const TokenType TEXT = const TokenType('TEXT', 11, null); 1169 static final TokenType TEXT = new TokenType('TEXT', 11, null);
1148 1170
1149 static const List<TokenType> values = const [ 1171 static final List<TokenType> values = [
1150 EOF, 1172 EOF,
1151 EQ, 1173 EQ,
1152 GT, 1174 GT,
1153 LT_SLASH, 1175 LT_SLASH,
1154 LT, 1176 LT,
1155 SLASH_GT, 1177 SLASH_GT,
1156 COMMENT, 1178 COMMENT,
1157 DECLARATION, 1179 DECLARATION,
1158 DIRECTIVE, 1180 DIRECTIVE,
1159 STRING, 1181 STRING,
1160 TAG, 1182 TAG,
1161 TEXT]; 1183 TEXT];
1162 1184
1163 /** 1185 /**
1164 * The lexeme that defines this type of token, or `null` if there is more than one possible 1186 * The lexeme that defines this type of token, or `null` if there is more than one possible
1165 * lexeme for this type of token. 1187 * lexeme for this type of token.
1166 */ 1188 */
1167 final String lexeme; 1189 String lexeme;
1168 1190
1169 const TokenType(String name, int ordinal, this.lexeme) : super(name, ordinal); 1191 TokenType(String name, int ordinal, String lexeme) : super(name, ordinal) {
1192 this.lexeme = lexeme;
1193 }
1170 } 1194 }
1171 1195
1172 class TokenType_EOF extends TokenType { 1196 class TokenType_EOF extends TokenType {
1173 const TokenType_EOF(String name, int ordinal, String arg0) : super(name, ordin al, arg0); 1197 TokenType_EOF(String name, int ordinal, String arg0) : super(name, ordinal, ar g0);
1174 1198
1175 @override 1199 @override
1176 String toString() => "-eof-"; 1200 String toString() => "-eof-";
1177 } 1201 }
1178 1202
1179 /** 1203 /**
1180 * Instances of `XmlAttributeNode` represent name/value pairs owned by an [XmlTa gNode]. 1204 * Instances of `XmlAttributeNode` represent name/value pairs owned by an [XmlTa gNode].
1181 */ 1205 */
1182 class XmlAttributeNode extends XmlNode { 1206 class XmlAttributeNode extends XmlNode {
1183 final Token _name; 1207 Token _name;
1184 1208
1185 final Token equals; 1209 Token equals;
1186 1210
1187 final Token _value; 1211 Token _value;
1188 1212
1189 List<XmlExpression> expressions = XmlExpression.EMPTY_ARRAY; 1213 List<XmlExpression> expressions = XmlExpression.EMPTY_ARRAY;
1190 1214
1191 /** 1215 /**
1192 * Construct a new instance representing an XML attribute. 1216 * Construct a new instance representing an XML attribute.
1193 * 1217 *
1194 * @param name the name token (not `null`). This may be a zero length token if the attribute 1218 * @param name the name token (not `null`). This may be a zero length token if the attribute
1195 * is badly formed. 1219 * is badly formed.
1196 * @param equals the equals sign or `null` if none 1220 * @param equals the equals sign or `null` if none
1197 * @param value the value token (not `null`) 1221 * @param value the value token (not `null`)
1198 */ 1222 */
1199 XmlAttributeNode(this._name, this.equals, this._value); 1223 XmlAttributeNode(Token name, Token equals, Token value) {
1224 this._name = name;
1225 this.equals = equals;
1226 this._value = value;
1227 }
1200 1228
1201 @override 1229 @override
1202 accept(XmlVisitor visitor) => visitor.visitXmlAttributeNode(this); 1230 accept(XmlVisitor visitor) => visitor.visitXmlAttributeNode(this);
1203 1231
1204 @override 1232 @override
1205 Token get beginToken => _name; 1233 Token get beginToken => _name;
1206 1234
1207 @override 1235 @override
1208 Token get endToken => _value; 1236 Token get endToken => _value;
1209 1237
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 } 1367 }
1340 1368
1341 /** 1369 /**
1342 * Instances of the class `XmlParser` are used to parse tokens into a AST struct ure comprised 1370 * Instances of the class `XmlParser` are used to parse tokens into a AST struct ure comprised
1343 * of [XmlNode]s. 1371 * of [XmlNode]s.
1344 */ 1372 */
1345 class XmlParser { 1373 class XmlParser {
1346 /** 1374 /**
1347 * The source being parsed. 1375 * The source being parsed.
1348 */ 1376 */
1349 final Source source; 1377 Source source;
1350 1378
1351 /** 1379 /**
1352 * The next token to be parsed. 1380 * The next token to be parsed.
1353 */ 1381 */
1354 Token _currentToken; 1382 Token _currentToken;
1355 1383
1356 /** 1384 /**
1357 * Construct a parser for the specified source. 1385 * Construct a parser for the specified source.
1358 * 1386 *
1359 * @param source the source being parsed 1387 * @param source the source being parsed
1360 */ 1388 */
1361 XmlParser(this.source); 1389 XmlParser(Source source) {
1390 this.source = source;
1391 }
1362 1392
1363 /** 1393 /**
1364 * Create a node representing an attribute. 1394 * Create a node representing an attribute.
1365 * 1395 *
1366 * @param name the name of the attribute 1396 * @param name the name of the attribute
1367 * @param equals the equals sign, or `null` if there is no value 1397 * @param equals the equals sign, or `null` if there is no value
1368 * @param value the value of the attribute 1398 * @param value the value of the attribute
1369 * @return the node that was created 1399 * @return the node that was created
1370 */ 1400 */
1371 XmlAttributeNode createAttributeNode(Token name, Token equals, Token value) => new XmlAttributeNode(name, equals, value); 1401 XmlAttributeNode createAttributeNode(Token name, Token equals, Token value) => new XmlAttributeNode(name, equals, value);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 static List<XmlAttributeNode> NO_ATTRIBUTES = new UnmodifiableListView(new Lis t<XmlAttributeNode>()); 1637 static List<XmlAttributeNode> NO_ATTRIBUTES = new UnmodifiableListView(new Lis t<XmlAttributeNode>());
1608 1638
1609 /** 1639 /**
1610 * Constant representing empty list of tag nodes. 1640 * Constant representing empty list of tag nodes.
1611 */ 1641 */
1612 static List<XmlTagNode> NO_TAG_NODES = new UnmodifiableListView(new List<XmlTa gNode>()); 1642 static List<XmlTagNode> NO_TAG_NODES = new UnmodifiableListView(new List<XmlTa gNode>());
1613 1643
1614 /** 1644 /**
1615 * The starting [TokenType#LT] token (not `null`). 1645 * The starting [TokenType#LT] token (not `null`).
1616 */ 1646 */
1617 final Token nodeStart; 1647 Token nodeStart;
1618 1648
1619 /** 1649 /**
1620 * The [TokenType#TAG] token after the starting '&lt;' (not `null`). 1650 * The [TokenType#TAG] token after the starting '&lt;' (not `null`).
1621 */ 1651 */
1622 final Token _tag; 1652 Token _tag;
1623 1653
1624 /** 1654 /**
1625 * The attributes contained by the receiver (not `null`, contains no `null`s). 1655 * The attributes contained by the receiver (not `null`, contains no `null`s).
1626 */ 1656 */
1627 List<XmlAttributeNode> _attributes; 1657 List<XmlAttributeNode> _attributes;
1628 1658
1629 /** 1659 /**
1630 * The [TokenType#GT] or [TokenType#SLASH_GT] token after the attributes (not 1660 * The [TokenType#GT] or [TokenType#SLASH_GT] token after the attributes (not
1631 * `null`). The token may be the same token as [nodeEnd] if there are no child 1661 * `null`). The token may be the same token as [nodeEnd] if there are no child
1632 * [tagNodes]. 1662 * [tagNodes].
1633 */ 1663 */
1634 final Token attributeEnd; 1664 Token attributeEnd;
1635 1665
1636 /** 1666 /**
1637 * The tag nodes contained in the receiver (not `null`, contains no `null`s). 1667 * The tag nodes contained in the receiver (not `null`, contains no `null`s).
1638 */ 1668 */
1639 List<XmlTagNode> _tagNodes; 1669 List<XmlTagNode> _tagNodes;
1640 1670
1641 /** 1671 /**
1642 * The token (not `null`) after the content, which may be 1672 * The token (not `null`) after the content, which may be
1643 * * (1) [TokenType#LT_SLASH] for nodes with open and close tags, or 1673 * * (1) [TokenType#LT_SLASH] for nodes with open and close tags, or
1644 * * (2) the [TokenType#LT] nodeStart of the next sibling node if this node is self 1674 * * (2) the [TokenType#LT] nodeStart of the next sibling node if this node is self
1645 * closing or the attributeEnd is [TokenType#SLASH_GT], or 1675 * closing or the attributeEnd is [TokenType#SLASH_GT], or
1646 * * (3) [TokenType#EOF] if the node does not have a closing tag and is the la st node in 1676 * * (3) [TokenType#EOF] if the node does not have a closing tag and is the la st node in
1647 * the stream [TokenType#LT_SLASH] token after the content, or `null` if there is no 1677 * the stream [TokenType#LT_SLASH] token after the content, or `null` if there is no
1648 * content and the attributes ended with [TokenType#SLASH_GT]. 1678 * content and the attributes ended with [TokenType#SLASH_GT].
1649 */ 1679 */
1650 final Token contentEnd; 1680 Token contentEnd;
1651 1681
1652 /** 1682 /**
1653 * The closing [TokenType#TAG] after the child elements or `null` if there is no 1683 * The closing [TokenType#TAG] after the child elements or `null` if there is no
1654 * content and the attributes ended with [TokenType#SLASH_GT] 1684 * content and the attributes ended with [TokenType#SLASH_GT]
1655 */ 1685 */
1656 final Token closingTag; 1686 Token closingTag;
1657 1687
1658 /** 1688 /**
1659 * The ending [TokenType#GT] or [TokenType#SLASH_GT] token (not `null`). 1689 * The ending [TokenType#GT] or [TokenType#SLASH_GT] token (not `null`).
1660 */ 1690 */
1661 final Token nodeEnd; 1691 Token nodeEnd;
1662 1692
1663 /** 1693 /**
1664 * The expressions that are embedded in the tag's content. 1694 * The expressions that are embedded in the tag's content.
1665 */ 1695 */
1666 List<XmlExpression> expressions = XmlExpression.EMPTY_ARRAY; 1696 List<XmlExpression> expressions = XmlExpression.EMPTY_ARRAY;
1667 1697
1668 /** 1698 /**
1669 * Construct a new instance representing an XML or HTML element 1699 * Construct a new instance representing an XML or HTML element
1670 * 1700 *
1671 * @param nodeStart the starting [TokenType#LT] token (not `null`) 1701 * @param nodeStart the starting [TokenType#LT] token (not `null`)
(...skipping 10 matching lines...) Expand all
1682 * * (2) the [TokenType#LT] nodeStart of the next sibling node if thi s node is 1712 * * (2) the [TokenType#LT] nodeStart of the next sibling node if thi s node is
1683 * self closing or the attributeEnd is [TokenType#SLASH_GT], or 1713 * self closing or the attributeEnd is [TokenType#SLASH_GT], or
1684 * * (3) [TokenType#EOF] if the node does not have a closing tag and is the last 1714 * * (3) [TokenType#EOF] if the node does not have a closing tag and is the last
1685 * node in the stream [TokenType#LT_SLASH] token after the content, o r `null` 1715 * node in the stream [TokenType#LT_SLASH] token after the content, o r `null`
1686 * if there is no content and the attributes ended with [TokenType#SL ASH_GT]. 1716 * if there is no content and the attributes ended with [TokenType#SL ASH_GT].
1687 * @param closingTag the closing [TokenType#TAG] after the child elements or ` null` if 1717 * @param closingTag the closing [TokenType#TAG] after the child elements or ` null` if
1688 * there is no content and the attributes ended with [TokenType#SLASH _GT] 1718 * there is no content and the attributes ended with [TokenType#SLASH _GT]
1689 * @param nodeEnd the ending [TokenType#GT] or [TokenType#SLASH_GT] token (not 1719 * @param nodeEnd the ending [TokenType#GT] or [TokenType#SLASH_GT] token (not
1690 * `null`) 1720 * `null`)
1691 */ 1721 */
1692 XmlTagNode(this.nodeStart, this._tag, List<XmlAttributeNode> attributes, this. attributeEnd, List<XmlTagNode> tagNodes, this.contentEnd, this.closingTag, this. nodeEnd) { 1722 XmlTagNode(Token nodeStart, Token tag, List<XmlAttributeNode> attributes, Toke n attributeEnd, List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, T oken nodeEnd) {
1723 this.nodeStart = nodeStart;
1724 this._tag = tag;
1693 this._attributes = becomeParentOfAll(attributes, ifEmpty: NO_ATTRIBUTES); 1725 this._attributes = becomeParentOfAll(attributes, ifEmpty: NO_ATTRIBUTES);
1726 this.attributeEnd = attributeEnd;
1694 this._tagNodes = becomeParentOfAll(tagNodes, ifEmpty: NO_TAG_NODES); 1727 this._tagNodes = becomeParentOfAll(tagNodes, ifEmpty: NO_TAG_NODES);
1728 this.contentEnd = contentEnd;
1729 this.closingTag = closingTag;
1730 this.nodeEnd = nodeEnd;
1695 } 1731 }
1696 1732
1697 @override 1733 @override
1698 accept(XmlVisitor visitor) => visitor.visitXmlTagNode(this); 1734 accept(XmlVisitor visitor) => visitor.visitXmlTagNode(this);
1699 1735
1700 /** 1736 /**
1701 * Answer the attribute with the specified name. 1737 * Answer the attribute with the specified name.
1702 * 1738 *
1703 * @param name the attribute name 1739 * @param name the attribute name
1704 * @return the attribute or `null` if no matching attribute is found 1740 * @return the attribute or `null` if no matching attribute is found
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 */ 1860 */
1825 class HtmlParser extends XmlParser { 1861 class HtmlParser extends XmlParser {
1826 /** 1862 /**
1827 * The line information associated with the source being parsed. 1863 * The line information associated with the source being parsed.
1828 */ 1864 */
1829 LineInfo _lineInfo; 1865 LineInfo _lineInfo;
1830 1866
1831 /** 1867 /**
1832 * The error listener to which errors will be reported. 1868 * The error listener to which errors will be reported.
1833 */ 1869 */
1834 final AnalysisErrorListener _errorListener; 1870 AnalysisErrorListener _errorListener;
1835 1871
1836 static String _APPLICATION_DART_IN_DOUBLE_QUOTES = "\"application/dart\""; 1872 static String _APPLICATION_DART_IN_DOUBLE_QUOTES = "\"application/dart\"";
1837 1873
1838 static String _APPLICATION_DART_IN_SINGLE_QUOTES = "'application/dart'"; 1874 static String _APPLICATION_DART_IN_SINGLE_QUOTES = "'application/dart'";
1839 1875
1840 static String _SCRIPT = "script"; 1876 static String _SCRIPT = "script";
1841 1877
1842 static String _TYPE = "type"; 1878 static String _TYPE = "type";
1843 1879
1844 /** 1880 /**
(...skipping 29 matching lines...) Expand all
1874 scanner.setSourceStart(location.lineNumber, location.columnNumber); 1910 scanner.setSourceStart(location.lineNumber, location.columnNumber);
1875 return scanner.tokenize(); 1911 return scanner.tokenize();
1876 } 1912 }
1877 1913
1878 /** 1914 /**
1879 * Construct a parser for the specified source. 1915 * Construct a parser for the specified source.
1880 * 1916 *
1881 * @param source the source being parsed 1917 * @param source the source being parsed
1882 * @param errorListener the error listener to which errors will be reported 1918 * @param errorListener the error listener to which errors will be reported
1883 */ 1919 */
1884 HtmlParser(Source source, this._errorListener) : super(source); 1920 HtmlParser(Source source, AnalysisErrorListener errorListener) : super(source) {
1921 this._errorListener = errorListener;
1922 }
1885 1923
1886 /** 1924 /**
1887 * Parse the given tokens. 1925 * Parse the given tokens.
1888 * 1926 *
1889 * @param token the first token in the stream of tokens to be parsed 1927 * @param token the first token in the stream of tokens to be parsed
1890 * @param lineInfo the line information created by the scanner 1928 * @param lineInfo the line information created by the scanner
1891 * @return the parse result (not `null`) 1929 * @return the parse result (not `null`)
1892 */ 1930 */
1893 HtmlUnit parse(Token token, LineInfo lineInfo) { 1931 HtmlUnit parse(Token token, LineInfo lineInfo) {
1894 this._lineInfo = lineInfo; 1932 this._lineInfo = lineInfo;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 } 1984 }
1947 } 1985 }
1948 1986
1949 /** 1987 /**
1950 * Instances of the class `HtmlUnit` represent the contents of an HTML file. 1988 * Instances of the class `HtmlUnit` represent the contents of an HTML file.
1951 */ 1989 */
1952 class HtmlUnit extends XmlNode { 1990 class HtmlUnit extends XmlNode {
1953 /** 1991 /**
1954 * The first token in the token stream that was parsed to form this HTML unit. 1992 * The first token in the token stream that was parsed to form this HTML unit.
1955 */ 1993 */
1956 final Token beginToken; 1994 Token beginToken;
1957 1995
1958 /** 1996 /**
1959 * The last token in the token stream that was parsed to form this compilation unit. This token 1997 * The last token in the token stream that was parsed to form this compilation unit. This token
1960 * should always have a type of [TokenType.EOF]. 1998 * should always have a type of [TokenType.EOF].
1961 */ 1999 */
1962 final Token endToken; 2000 Token endToken;
1963 2001
1964 /** 2002 /**
1965 * The tag nodes contained in the receiver (not `null`, contains no `null`s). 2003 * The tag nodes contained in the receiver (not `null`, contains no `null`s).
1966 */ 2004 */
1967 List<XmlTagNode> _tagNodes; 2005 List<XmlTagNode> _tagNodes;
1968 2006
1969 /** 2007 /**
1970 * Construct a new instance representing the content of an HTML file. 2008 * Construct a new instance representing the content of an HTML file.
1971 * 2009 *
1972 * @param beginToken the first token in the file (not `null`) 2010 * @param beginToken the first token in the file (not `null`)
1973 * @param tagNodes child tag nodes of the receiver (not `null`, contains no `n ull`s) 2011 * @param tagNodes child tag nodes of the receiver (not `null`, contains no `n ull`s)
1974 * @param endToken the last token in the token stream which should be of type 2012 * @param endToken the last token in the token stream which should be of type
1975 * [TokenType.EOF] 2013 * [TokenType.EOF]
1976 */ 2014 */
1977 HtmlUnit(this.beginToken, List<XmlTagNode> tagNodes, this.endToken) { 2015 HtmlUnit(Token beginToken, List<XmlTagNode> tagNodes, Token endToken) {
2016 this.beginToken = beginToken;
1978 this._tagNodes = becomeParentOfAll(tagNodes); 2017 this._tagNodes = becomeParentOfAll(tagNodes);
2018 this.endToken = endToken;
1979 } 2019 }
1980 2020
1981 @override 2021 @override
1982 accept(XmlVisitor visitor) => visitor.visitHtmlUnit(this); 2022 accept(XmlVisitor visitor) => visitor.visitHtmlUnit(this);
1983 2023
1984 /** 2024 /**
1985 * Return the element associated with this HTML unit. 2025 * Return the element associated with this HTML unit.
1986 * 2026 *
1987 * @return the element or `null` if the receiver is not resolved 2027 * @return the element or `null` if the receiver is not resolved
1988 */ 2028 */
(...skipping 16 matching lines...) Expand all
2005 super.element = element; 2045 super.element = element;
2006 } 2046 }
2007 2047
2008 @override 2048 @override
2009 void visitChildren(XmlVisitor visitor) { 2049 void visitChildren(XmlVisitor visitor) {
2010 for (XmlTagNode node in _tagNodes) { 2050 for (XmlTagNode node in _tagNodes) {
2011 node.accept(visitor); 2051 node.accept(visitor);
2012 } 2052 }
2013 } 2053 }
2014 } 2054 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/lib/src/generated/index.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698