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

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

Issue 12473003: Remove deprecated StringBuffer.add, addAll and addCharCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
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 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 if (_previousToken.kind == TokenKind.GREATER_THAN) { 665 if (_previousToken.kind == TokenKind.GREATER_THAN) {
666 // If the next token is } could be the close template token. If user 666 // If the next token is } could be the close template token. If user
667 // needs } as token in text node use the entity &125; 667 // needs } as token in text node use the entity &125;
668 // TODO(terry): Probably need a &RCURLY entity instead of 125. 668 // TODO(terry): Probably need a &RCURLY entity instead of 125.
669 if (_peek() == TokenKind.ERROR) { 669 if (_peek() == TokenKind.ERROR) {
670 // Backup, just past previous token, & rescan we're outside of the tag. 670 // Backup, just past previous token, & rescan we're outside of the tag.
671 tokenizer.index = _previousToken.end; 671 tokenizer.index = _previousToken.end;
672 _next(false); 672 _next(false);
673 } else if (_peek() != TokenKind.RBRACE) { 673 } else if (_peek() != TokenKind.RBRACE) {
674 // Yes, grab the chars after the > 674 // Yes, grab the chars after the >
675 stringValue.add(_previousToken.source.text.substring( 675 stringValue.write(_previousToken.source.text.substring(
676 this._previousToken.end, this._peekToken.start)); 676 this._previousToken.end, this._peekToken.start));
677 } 677 }
678 } 678 }
679 679
680 // Gobble up everything until we hit < 680 // Gobble up everything until we hit <
681 while (_peek() != TokenKind.LESS_THAN && 681 while (_peek() != TokenKind.LESS_THAN &&
682 _peek() != TokenKind.START_COMMAND && 682 _peek() != TokenKind.START_COMMAND &&
683 _peek() != TokenKind.END_COMMAND && 683 _peek() != TokenKind.END_COMMAND &&
684 (_peek() != TokenKind.RBRACE || 684 (_peek() != TokenKind.RBRACE ||
685 (_peek() == TokenKind.RBRACE && inExpression)) && 685 (_peek() == TokenKind.RBRACE && inExpression)) &&
(...skipping 13 matching lines...) Expand all
699 var tok = _next(false); 699 var tok = _next(false);
700 if (tok.kind == TokenKind.RBRACE && inExpression) { 700 if (tok.kind == TokenKind.RBRACE && inExpression) {
701 // We have an expression create the expression node, don't save the } 701 // We have an expression create the expression node, don't save the }
702 inExpression = false; 702 inExpression = false;
703 nodes.add(new TemplateExpression(stringValue.toString(), 703 nodes.add(new TemplateExpression(stringValue.toString(),
704 _makeSpan(start))); 704 _makeSpan(start)));
705 stringValue = new StringBuffer(); 705 stringValue = new StringBuffer();
706 start = _peekToken.start; 706 start = _peekToken.start;
707 } else if (tok.kind != TokenKind.START_EXPRESSION) { 707 } else if (tok.kind != TokenKind.START_EXPRESSION) {
708 // Only save the the contents between ${ and } 708 // Only save the the contents between ${ and }
709 stringValue.add(tok.text); 709 stringValue.write(tok.text);
710 } 710 }
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698