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

Side by Side Diff: src/scanner.cc

Issue 389503002: Revert "Implement handling of arrow functions in the parser" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | « src/scanner.h ('k') | src/token.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Features shared by parsing and pre-parsing scanners. 5 // Features shared by parsing and pre-parsing scanners.
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 token = Select('=', Token::ASSIGN_SHR, Token::SHR); 459 token = Select('=', Token::ASSIGN_SHR, Token::SHR);
460 } else { 460 } else {
461 token = Token::SAR; 461 token = Token::SAR;
462 } 462 }
463 } else { 463 } else {
464 token = Token::GT; 464 token = Token::GT;
465 } 465 }
466 break; 466 break;
467 467
468 case '=': 468 case '=':
469 // = == === => 469 // = == ===
470 Advance(); 470 Advance();
471 if (c0_ == '=') { 471 if (c0_ == '=') {
472 token = Select('=', Token::EQ_STRICT, Token::EQ); 472 token = Select('=', Token::EQ_STRICT, Token::EQ);
473 } else if (c0_ == '>') {
474 token = Select(Token::ARROW);
475 } else { 473 } else {
476 token = Token::ASSIGN; 474 token = Token::ASSIGN;
477 } 475 }
478 break; 476 break;
479 477
480 case '!': 478 case '!':
481 // ! != !== 479 // ! != !==
482 Advance(); 480 Advance();
483 if (c0_ == '=') { 481 if (c0_ == '=') {
484 token = Select('=', Token::NE_STRICT, Token::NE); 482 token = Select('=', Token::NE_STRICT, Token::NE);
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 (keyword_length <= 9 || input[9] == keyword[9])) { \ 999 (keyword_length <= 9 || input[9] == keyword[9])) { \
1002 return token; \ 1000 return token; \
1003 } \ 1001 } \
1004 } 1002 }
1005 KEYWORDS(KEYWORD_GROUP_CASE, KEYWORD) 1003 KEYWORDS(KEYWORD_GROUP_CASE, KEYWORD)
1006 } 1004 }
1007 return Token::IDENTIFIER; 1005 return Token::IDENTIFIER;
1008 } 1006 }
1009 1007
1010 1008
1011 bool Scanner::IdentifierIsFutureStrictReserved(
1012 const AstRawString* string) const {
1013 // Keywords are always 1-byte strings.
1014 return string->is_one_byte() &&
1015 Token::FUTURE_STRICT_RESERVED_WORD ==
1016 KeywordOrIdentifierToken(string->raw_data(), string->length(),
1017 harmony_scoping_, harmony_modules_);
1018 }
1019
1020
1021 Token::Value Scanner::ScanIdentifierOrKeyword() { 1009 Token::Value Scanner::ScanIdentifierOrKeyword() {
1022 ASSERT(unicode_cache_->IsIdentifierStart(c0_)); 1010 ASSERT(unicode_cache_->IsIdentifierStart(c0_));
1023 LiteralScope literal(this); 1011 LiteralScope literal(this);
1024 // Scan identifier start character. 1012 // Scan identifier start character.
1025 if (c0_ == '\\') { 1013 if (c0_ == '\\') {
1026 uc32 c = ScanIdentifierUnicodeEscape(); 1014 uc32 c = ScanIdentifierUnicodeEscape();
1027 // Only allow legal identifier start characters. 1015 // Only allow legal identifier start characters.
1028 if (c < 0 || 1016 if (c < 0 ||
1029 c == '\\' || // No recursive escapes. 1017 c == '\\' || // No recursive escapes.
1030 !unicode_cache_->IsIdentifierStart(c)) { 1018 !unicode_cache_->IsIdentifierStart(c)) {
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 } 1343 }
1356 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); 1344 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u));
1357 } 1345 }
1358 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); 1346 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f));
1359 1347
1360 backing_store_.AddBlock(bytes); 1348 backing_store_.AddBlock(bytes);
1361 return backing_store_.EndSequence().start(); 1349 return backing_store_.EndSequence().start();
1362 } 1350 }
1363 1351
1364 } } // namespace v8::internal 1352 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/scanner.h ('k') | src/token.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698