OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Generated by scripts/tree_gen.py. | 4 // Generated by scripts/tree_gen.py. |
5 | 5 |
6 ///////////////////////////////////////////////////////////////////////// | 6 ///////////////////////////////////////////////////////////////////////// |
7 // CSS specific types: | 7 // CSS specific types: |
8 ///////////////////////////////////////////////////////////////////////// | 8 ///////////////////////////////////////////////////////////////////////// |
9 | 9 |
10 class Identifier extends ASTNode { | 10 class Identifier extends ASTNode { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 add(var child) { | 88 add(var child) { |
89 if (children == null) { | 89 if (children == null) { |
90 children = new List<ASTNode>(); | 90 children = new List<ASTNode>(); |
91 } | 91 } |
92 children.add(child); | 92 children.add(child); |
93 } | 93 } |
94 | 94 |
95 ASTNode last() => children.last(); | 95 ASTNode last() => children.last(); |
96 ASTNode removeLast() => children.removeLast(); | 96 ASTNode removeLast() => children.removeLast(); |
97 bool get anyChildren() => children != null && children.length > 0; | 97 bool get anyChildren => children != null && children.length > 0; |
98 | 98 |
99 visit(TreeVisitor visitor) => visitor.visitTemplateChildren(this); | 99 visit(TreeVisitor visitor) => visitor.visitTemplateChildren(this); |
100 | 100 |
101 String toString() { | 101 String toString() { |
102 StringBuffer buff = new StringBuffer(); | 102 StringBuffer buff = new StringBuffer(); |
103 if (children != null) { | 103 if (children != null) { |
104 for (final child in children) { | 104 for (final child in children) { |
105 buff.add(child.toString()); | 105 buff.add(child.toString()); |
106 } | 106 } |
107 } | 107 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 class TemplateElement extends TemplateChildren { | 162 class TemplateElement extends TemplateChildren { |
163 int tagTokenId; | 163 int tagTokenId; |
164 List<TemplateAttribute> attributes; | 164 List<TemplateAttribute> attributes; |
165 StringValue _varName; | 165 StringValue _varName; |
166 | 166 |
167 TemplateElement(this.tagTokenId, SourceSpan span): super.empty(span); | 167 TemplateElement(this.tagTokenId, SourceSpan span): super.empty(span); |
168 TemplateElement.fragment(SourceSpan span) : super.empty(span), tagTokenId = -1
; | 168 TemplateElement.fragment(SourceSpan span) : super.empty(span), tagTokenId = -1
; |
169 TemplateElement.attributes(this.tagTokenId, this.attributes, this._varName, | 169 TemplateElement.attributes(this.tagTokenId, this.attributes, this._varName, |
170 SourceSpan span): super.empty(span); | 170 SourceSpan span): super.empty(span); |
171 | 171 |
172 bool get isFragment() => tagTokenId == -1; | 172 bool get isFragment => tagTokenId == -1; |
173 bool get anyAttributes() => attributes != null; | 173 bool get anyAttributes => attributes != null; |
174 | 174 |
175 visit(TreeVisitor visitor) => visitor.visitTemplateElement(this); | 175 visit(TreeVisitor visitor) => visitor.visitTemplateElement(this); |
176 | 176 |
177 bool get hasVar() => _varName != null; | 177 bool get hasVar => _varName != null; |
178 String get varName() => hasVar ? _varName.value : null; | 178 String get varName => hasVar ? _varName.value : null; |
179 | 179 |
180 String attributesToString() { | 180 String attributesToString() { |
181 StringBuffer buff = new StringBuffer(); | 181 StringBuffer buff = new StringBuffer(); |
182 | 182 |
183 if (attributes != null) { | 183 if (attributes != null) { |
184 for (final attr in attributes) { | 184 for (final attr in attributes) { |
185 buff.add(' ${attr.toString()}'); | 185 buff.add(' ${attr.toString()}'); |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 return buff.toString(); | 189 return buff.toString(); |
190 } | 190 } |
191 | 191 |
192 String get tagName() => isFragment ? | 192 String get tagName => isFragment ? |
193 'root' : TokenKind.tagNameFromTokenId(tagTokenId); | 193 'root' : TokenKind.tagNameFromTokenId(tagTokenId); |
194 | 194 |
195 bool get scoped() => !TokenKind.unscopedTag(tagTokenId); | 195 bool get scoped => !TokenKind.unscopedTag(tagTokenId); |
196 | 196 |
197 String tagStartToString() => "<${tagName}${attributesToString()}>"; | 197 String tagStartToString() => "<${tagName}${attributesToString()}>"; |
198 | 198 |
199 String tagEndToString() => "</${tagName}>"; | 199 String tagEndToString() => "</${tagName}>"; |
200 | 200 |
201 String toString() { | 201 String toString() { |
202 StringBuffer buff = new StringBuffer(tagStartToString()); | 202 StringBuffer buff = new StringBuffer(tagStartToString()); |
203 | 203 |
204 if (children != null) { | 204 if (children != null) { |
205 for (final child in children) { | 205 for (final child in children) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 245 } |
246 | 246 |
247 class TemplateEachCommand extends ASTNode { | 247 class TemplateEachCommand extends ASTNode { |
248 String listName; | 248 String listName; |
249 String loopItem; | 249 String loopItem; |
250 TemplateDocument documentFragment; | 250 TemplateDocument documentFragment; |
251 | 251 |
252 TemplateEachCommand(this.listName, this.loopItem, this.documentFragment, | 252 TemplateEachCommand(this.listName, this.loopItem, this.documentFragment, |
253 SourceSpan span): super(span); | 253 SourceSpan span): super(span); |
254 | 254 |
255 bool get hasLoopItem() => loopItem != null; | 255 bool get hasLoopItem => loopItem != null; |
256 String get loopNameOptional() => hasLoopItem ? " ${loopItem}" : ""; | 256 String get loopNameOptional => hasLoopItem ? " ${loopItem}" : ""; |
257 | 257 |
258 visit(TreeVisitor visitor) => visitor.visitTemplateEachCommand(this); | 258 visit(TreeVisitor visitor) => visitor.visitTemplateEachCommand(this); |
259 | 259 |
260 String toString() => "\$\{#each ${listName}${loopNameOptional}}"; | 260 String toString() => "\$\{#each ${listName}${loopNameOptional}}"; |
261 } | 261 } |
262 | 262 |
263 class TemplateWithCommand extends ASTNode { | 263 class TemplateWithCommand extends ASTNode { |
264 String objectName; | 264 String objectName; |
265 String blockItem; | 265 String blockItem; |
266 TemplateDocument documentFragment; | 266 TemplateDocument documentFragment; |
267 | 267 |
268 TemplateWithCommand(this.objectName, this.blockItem, this.documentFragment, | 268 TemplateWithCommand(this.objectName, this.blockItem, this.documentFragment, |
269 SourceSpan span): super(span); | 269 SourceSpan span): super(span); |
270 | 270 |
271 bool get hasBlockItem() => blockItem != null; | 271 bool get hasBlockItem => blockItem != null; |
272 String get blockNameOptional() => hasBlockItem ? " ${blockItem}" : ""; | 272 String get blockNameOptional => hasBlockItem ? " ${blockItem}" : ""; |
273 | 273 |
274 visit(TreeVisitor visitor) => visitor.visitTemplateWithCommand(this); | 274 visit(TreeVisitor visitor) => visitor.visitTemplateWithCommand(this); |
275 | 275 |
276 String toString() => "\$\{#with ${objectName}${blockNameOptional}}"; | 276 String toString() => "\$\{#with ${objectName}${blockNameOptional}}"; |
277 } | 277 } |
278 | 278 |
279 class TemplateCall extends ASTNode { | 279 class TemplateCall extends ASTNode { |
280 String toCall; | 280 String toCall; |
281 String params; | 281 String params; |
282 | 282 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 output.writeValue('params', node.params); | 415 output.writeValue('params', node.params); |
416 } | 416 } |
417 | 417 |
418 void visitTemplateGetter(TemplateGetter node) { | 418 void visitTemplateGetter(TemplateGetter node) { |
419 output.heading('template getter', node.span); | 419 output.heading('template getter', node.span); |
420 output.writeValue('getter Signature', node.getterSignatureAsString()); | 420 output.writeValue('getter Signature', node.getterSignatureAsString()); |
421 visitTemplateDocument(node.docFrag); | 421 visitTemplateDocument(node.docFrag); |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
OLD | NEW |