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 | 3 |
4 class TagStack { | 4 class TagStack { |
5 List<ASTNode> _stack; | 5 List<ASTNode> _stack; |
6 | 6 |
7 TagStack(var elem) : _stack = [] { | 7 TagStack(var elem) : _stack = [] { |
8 _stack.add(elem); | 8 _stack.add(elem); |
9 } | 9 } |
10 | 10 |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 int scopeType; // 1 implies scoped, 2 implies non-scoped element. | 447 int scopeType; // 1 implies scoped, 2 implies non-scoped element. |
448 if (_maybeEat(TokenKind.GREATER_THAN)) { | 448 if (_maybeEat(TokenKind.GREATER_THAN)) { |
449 // Scoped unless the tag is explicitly known as an unscoped tag | 449 // Scoped unless the tag is explicitly known as an unscoped tag |
450 // e.g., <br>. | 450 // e.g., <br>. |
451 scopeType = TokenKind.unscopedTag(tagToken.kind) ? 2 : 1; | 451 scopeType = TokenKind.unscopedTag(tagToken.kind) ? 2 : 1; |
452 } else if (_maybeEat(TokenKind.END_NO_SCOPE_TAG)) { | 452 } else if (_maybeEat(TokenKind.END_NO_SCOPE_TAG)) { |
453 scopeType = 2; | 453 scopeType = 2; |
454 } | 454 } |
455 if (scopeType > 0) { | 455 if (scopeType > 0) { |
456 var elem = new TemplateElement.attributes(tagToken.kind, | 456 var elem = new TemplateElement.attributes(tagToken.kind, |
457 attrs.values, varName, _makeSpan(start)); | 457 attrs.values.toList(), varName, _makeSpan(start)); |
458 stack.top().add(elem); | 458 stack.top().add(elem); |
459 | 459 |
460 if (scopeType == 1) { | 460 if (scopeType == 1) { |
461 // Maybe more nested tags/text? | 461 // Maybe more nested tags/text? |
462 stack.push(elem); | 462 stack.push(elem); |
463 } | 463 } |
464 } | 464 } |
465 } else { | 465 } else { |
466 // Close tag | 466 // Close tag |
467 _eat(TokenKind.SLASH); | 467 _eat(TokenKind.SLASH); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 } | 711 } |
712 | 712 |
713 if (stringValue.length > 0) { | 713 if (stringValue.length > 0) { |
714 nodes.add(new TemplateText(stringValue.toString(), _makeSpan(start))); | 714 nodes.add(new TemplateText(stringValue.toString(), _makeSpan(start))); |
715 } | 715 } |
716 | 716 |
717 return nodes; | 717 return nodes; |
718 } | 718 } |
719 | 719 |
720 } | 720 } |
OLD | NEW |