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

Side by Side Diff: utils/template/htmltree.dart

Issue 9728009: Template bug fixes and new features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Undid css.status change Created 8 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 | « utils/template/codegen.dart ('k') | utils/template/parser.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) 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 TemplateExpression(this.expression, SourceSpan span): super(span); 203 TemplateExpression(this.expression, SourceSpan span): super(span);
204 204
205 visit(TreeVisitor visitor) => visitor.visitTemplateExpression(this); 205 visit(TreeVisitor visitor) => visitor.visitTemplateExpression(this);
206 206
207 String toString() => "\$\{value}"; 207 String toString() => "\$\{value}";
208 } 208 }
209 209
210 class TemplateEachCommand extends ASTNode { 210 class TemplateEachCommand extends ASTNode {
211 String listName; 211 String listName;
212 String loopItem;
212 TemplateDocument documentFragment; 213 TemplateDocument documentFragment;
213 214
214 TemplateEachCommand(this.listName, this.documentFragment, SourceSpan span): 215 TemplateEachCommand(this.listName, this.loopItem, this.documentFragment,
215 super(span); 216 SourceSpan span): super(span);
217
218 bool get hasLoopItem() => loopItem != null;
219 String get loopNameOptional() => hasLoopItem ? " ${loopItem}" : "";
216 220
217 visit(TreeVisitor visitor) => visitor.visitTemplateEachCommand(this); 221 visit(TreeVisitor visitor) => visitor.visitTemplateEachCommand(this);
218 222
219 String toString() => "\$\{#each ${listName}}"; 223 String toString() => "\$\{#each ${listName}${loopNameOptional}}";
220 } 224 }
221 225
222 class TemplateWithCommand extends ASTNode { 226 class TemplateWithCommand extends ASTNode {
223 String objectName; 227 String objectName;
228 String blockItem;
224 TemplateDocument documentFragment; 229 TemplateDocument documentFragment;
225 230
226 TemplateWithCommand(this.objectName, this.documentFragment, SourceSpan span): 231 TemplateWithCommand(this.objectName, this.blockItem, this.documentFragment,
227 super(span); 232 SourceSpan span): super(span);
233
234 bool get hasBlockItem() => blockItem != null;
235 String get blockNameOptional() => hasBlockItem ? " ${blockItem}" : "";
228 236
229 visit(TreeVisitor visitor) => visitor.visitTemplateWithCommand(this); 237 visit(TreeVisitor visitor) => visitor.visitTemplateWithCommand(this);
230 238
231 String toString() => "\$\{#with ${objectName}}"; 239 String toString() => "\$\{#with ${objectName}${blockNameOptional}}";
240 }
241
242 class TemplateCall extends ASTNode {
243 String toCall;
244 String params;
245
246 TemplateCall(this.toCall, this.params, SourceSpan span): super(span);
247
248 visit(TreeVisitor visitor) => visitor.visitTemplateCall(this);
249
250 String toString() => "\$\{#${toCall}${params}}";
232 } 251 }
233 252
234 interface TreeVisitor { 253 interface TreeVisitor {
235 void visitIdentifier(Identifier node); 254 void visitIdentifier(Identifier node);
236 void visitStringValue(StringValue node); 255 void visitStringValue(StringValue node);
237 void visitCommentDefinition(CommentDefinition node); 256 void visitCommentDefinition(CommentDefinition node);
238 void visitTemplate(Template node); 257 void visitTemplate(Template node);
239 void visitTemplateSignature(TemplateSignature node); 258 void visitTemplateSignature(TemplateSignature node);
240 void visitTemplateChildren(TemplateChildren node); 259 void visitTemplateChildren(TemplateChildren node);
241 void visitTemplateDocument(TemplateDocument node); 260 void visitTemplateDocument(TemplateDocument node);
242 void visitTemplateContent(TemplateContent node); 261 void visitTemplateContent(TemplateContent node);
243 void visitTemplateElement(TemplateElement node); 262 void visitTemplateElement(TemplateElement node);
244 void visitTemplateAttribute(TemplateAttribute node); 263 void visitTemplateAttribute(TemplateAttribute node);
245 void visitTemplateText(TemplateText node); 264 void visitTemplateText(TemplateText node);
246 void visitTemplateExpression(TemplateExpression node); 265 void visitTemplateExpression(TemplateExpression node);
247 void visitTemplateEachCommand(TemplateEachCommand node); 266 void visitTemplateEachCommand(TemplateEachCommand node);
248 void visitTemplateWithCommand(TemplateWithCommand node); 267 void visitTemplateWithCommand(TemplateWithCommand node);
268 void visitTemplateCall(TemplateCall node);
249 } 269 }
250 270
251 class TreePrinter implements TreeVisitor { 271 class TreePrinter implements TreeVisitor {
252 var output; 272 var output;
253 TreePrinter(this.output) { output.printer = this; } 273 TreePrinter(this.output) { output.printer = this; }
254 274
255 void visitIdentifier(Identifier node) { 275 void visitIdentifier(Identifier node) {
256 output.heading('Identifier(${output.toValue(node.name)})', node.span); 276 output.heading('Identifier(${output.toValue(node.name)})', node.span);
257 } 277 }
258 278
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 output.heading('#each', node.span); 357 output.heading('#each', node.span);
338 output.writeValue('list', node.listName); 358 output.writeValue('list', node.listName);
339 visitTemplateDocument(node.documentFragment); 359 visitTemplateDocument(node.documentFragment);
340 } 360 }
341 361
342 void visitTemplateWithCommand(TemplateWithCommand node) { 362 void visitTemplateWithCommand(TemplateWithCommand node) {
343 output.heading('#with', node.span); 363 output.heading('#with', node.span);
344 output.writeValue('object', node.objectName); 364 output.writeValue('object', node.objectName);
345 visitTemplateDocument(node.documentFragment); 365 visitTemplateDocument(node.documentFragment);
346 } 366 }
367
368 void visitTemplateCall(TemplateCall node) {
369 output.heading('#call template', node.span);
370 output.writeValue('templateToCall', node.toCall);
371 output.writeValue('params', node.params);
372 }
373
347 } 374 }
348 375
OLDNEW
« no previous file with comments | « utils/template/codegen.dart ('k') | utils/template/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698