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

Side by Side Diff: dart/lib/compiler/implementation/scanner/parser.dart

Issue 10870066: Support unary - operator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix unparser to handle that negate is no longer a keyword. Created 8 years, 3 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * An event generating parser of Dart programs. This parser expects 6 * An event generating parser of Dart programs. This parser expects
7 * all tokens in a linked list (aka a token stream). 7 * all tokens in a linked list (aka a token stream).
8 * 8 *
9 * The class [Scanner] is used to generate a token stream. See the 9 * The class [Scanner] is used to generate a token stream. See the
10 * file scanner.dart. 10 * file scanner.dart.
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 token = parseIdentifier(token.next); 718 token = parseIdentifier(token.next);
719 } 719 }
720 token = parseFormalParameters(token); 720 token = parseFormalParameters(token);
721 token = parseFunctionBody(token, false); 721 token = parseFunctionBody(token, false);
722 listener.endFactoryMethod(start, period, token); 722 listener.endFactoryMethod(start, period, token);
723 return token.next; 723 return token.next;
724 } 724 }
725 725
726 Token parseOperatorName(Token token) { 726 Token parseOperatorName(Token token) {
727 assert(optional('operator', token)); 727 assert(optional('operator', token));
728 if (isUserDefinableOperator(token.next.stringValue)) { 728 if (isUserDefinableOperator(token.next.stringValue)
729 // TODO(ahe): Remove negate.
730 || token.next.value == const SourceString("negate")) {
729 Token operator = token; 731 Token operator = token;
730 token = token.next; 732 token = token.next;
731 listener.handleOperatorName(operator, token); 733 listener.handleOperatorName(operator, token);
732 return token.next; 734 return token.next;
733 } else { 735 } else {
734 return parseIdentifier(token); 736 return parseIdentifier(token);
735 } 737 }
736 } 738 }
737 739
738 Token parseFunction(Token token, Token getOrSet) { 740 Token parseFunction(Token token, Token getOrSet) {
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 } 1840 }
1839 listener.handleContinueStatement(hasTarget, continueKeyword, token); 1841 listener.handleContinueStatement(hasTarget, continueKeyword, token);
1840 return expectSemicolon(token); 1842 return expectSemicolon(token);
1841 } 1843 }
1842 1844
1843 Token parseEmptyStatement(Token token) { 1845 Token parseEmptyStatement(Token token) {
1844 listener.handleEmptyStatement(token); 1846 listener.handleEmptyStatement(token);
1845 return expectSemicolon(token); 1847 return expectSemicolon(token);
1846 } 1848 }
1847 } 1849 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/scanner/keyword.dart ('k') | dart/lib/compiler/implementation/scanner/token.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698