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

Side by Side Diff: runtime/vm/parser.cc

Issue 23531075: Properly parse symbol literals in top-level expression (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « runtime/vm/parser.h ('k') | no next file » | 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) 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 #include "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 10288 matching lines...) Expand 10 before | Expand all | Expand 10 after
10299 } 10299 }
10300 if ((CurrentToken() == Token::kLBRACK) || 10300 if ((CurrentToken() == Token::kLBRACK) ||
10301 (CurrentToken() == Token::kINDEX)) { 10301 (CurrentToken() == Token::kINDEX)) {
10302 SkipListLiteral(); 10302 SkipListLiteral();
10303 } else if (CurrentToken() == Token::kLBRACE) { 10303 } else if (CurrentToken() == Token::kLBRACE) {
10304 SkipMapLiteral(); 10304 SkipMapLiteral();
10305 } 10305 }
10306 } 10306 }
10307 10307
10308 10308
10309 void Parser::SkipSymbolLiteral() {
10310 ConsumeToken(); // Hash sign.
10311 if (IsIdentifier()) {
10312 ConsumeToken();
10313 while (CurrentToken() == Token::kPERIOD) {
10314 ConsumeToken();
10315 ExpectIdentifier("identifier expected");
10316 }
10317 } else if (Token::CanBeOverloaded(CurrentToken())) {
10318 ConsumeToken();
10319 } else {
10320 UnexpectedToken();
10321 }
10322 }
10323
10324
10309 void Parser::SkipNewOperator() { 10325 void Parser::SkipNewOperator() {
10310 ConsumeToken(); // Skip new or const keyword. 10326 ConsumeToken(); // Skip new or const keyword.
10311 if (IsIdentifier()) { 10327 if (IsIdentifier()) {
10312 SkipType(false); 10328 SkipType(false);
10313 if (CurrentToken() == Token::kLPAREN) { 10329 if (CurrentToken() == Token::kLPAREN) {
10314 SkipActualParameters(); 10330 SkipActualParameters();
10315 return; 10331 return;
10316 } 10332 }
10317 } 10333 }
10318 } 10334 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
10376 } else { 10392 } else {
10377 SkipNewOperator(); 10393 SkipNewOperator();
10378 } 10394 }
10379 break; 10395 break;
10380 case Token::kLT: 10396 case Token::kLT:
10381 case Token::kLBRACE: 10397 case Token::kLBRACE:
10382 case Token::kLBRACK: 10398 case Token::kLBRACK:
10383 case Token::kINDEX: 10399 case Token::kINDEX:
10384 SkipCompoundLiteral(); 10400 SkipCompoundLiteral();
10385 break; 10401 break;
10402 case Token::kHASH:
10403 SkipSymbolLiteral();
10404 break;
10386 default: 10405 default:
10387 if (IsIdentifier()) { 10406 if (IsIdentifier()) {
10388 ConsumeToken(); // Handle pseudo-keyword identifiers. 10407 ConsumeToken(); // Handle pseudo-keyword identifiers.
10389 } else { 10408 } else {
10390 UnexpectedToken(); 10409 UnexpectedToken();
10391 UNREACHABLE(); 10410 UNREACHABLE();
10392 } 10411 }
10393 break; 10412 break;
10394 } 10413 }
10395 } 10414 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
10498 void Parser::SkipQualIdent() { 10517 void Parser::SkipQualIdent() {
10499 ASSERT(IsIdentifier()); 10518 ASSERT(IsIdentifier());
10500 ConsumeToken(); 10519 ConsumeToken();
10501 if (CurrentToken() == Token::kPERIOD) { 10520 if (CurrentToken() == Token::kPERIOD) {
10502 ConsumeToken(); // Consume the kPERIOD token. 10521 ConsumeToken(); // Consume the kPERIOD token.
10503 ExpectIdentifier("identifier expected after '.'"); 10522 ExpectIdentifier("identifier expected after '.'");
10504 } 10523 }
10505 } 10524 }
10506 10525
10507 } // namespace dart 10526 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698