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

Side by Side Diff: src/parsing/scanner.cc

Issue 1678303002: [es7] implement exponentiation operator proposal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
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 "src/parsing/scanner.h" 7 #include "src/parsing/scanner.h"
8 8
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 22 matching lines...) Expand all
33 void Utf16CharacterStream::ResetToBookmark() { UNREACHABLE(); } 33 void Utf16CharacterStream::ResetToBookmark() { UNREACHABLE(); }
34 34
35 35
36 // ---------------------------------------------------------------------------- 36 // ----------------------------------------------------------------------------
37 // Scanner 37 // Scanner
38 38
39 Scanner::Scanner(UnicodeCache* unicode_cache) 39 Scanner::Scanner(UnicodeCache* unicode_cache)
40 : unicode_cache_(unicode_cache), 40 : unicode_cache_(unicode_cache),
41 bookmark_c0_(kNoBookmark), 41 bookmark_c0_(kNoBookmark),
42 octal_pos_(Location::invalid()), 42 octal_pos_(Location::invalid()),
43 found_html_comment_(false) { 43 found_html_comment_(false),
44 allow_harmony_exponentiation_operator_(false) {
44 bookmark_current_.literal_chars = &bookmark_current_literal_; 45 bookmark_current_.literal_chars = &bookmark_current_literal_;
45 bookmark_current_.raw_literal_chars = &bookmark_current_raw_literal_; 46 bookmark_current_.raw_literal_chars = &bookmark_current_raw_literal_;
46 bookmark_next_.literal_chars = &bookmark_next_literal_; 47 bookmark_next_.literal_chars = &bookmark_next_literal_;
47 bookmark_next_.raw_literal_chars = &bookmark_next_raw_literal_; 48 bookmark_next_.raw_literal_chars = &bookmark_next_raw_literal_;
48 } 49 }
49 50
50 51
51 void Scanner::Initialize(Utf16CharacterStream* source) { 52 void Scanner::Initialize(Utf16CharacterStream* source) {
52 source_ = source; 53 source_ = source;
53 // Need to capture identifiers in order to recognize "get" and "set" 54 // Need to capture identifiers in order to recognize "get" and "set"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 } 559 }
559 } else if (c0_ == '=') { 560 } else if (c0_ == '=') {
560 token = Select(Token::ASSIGN_SUB); 561 token = Select(Token::ASSIGN_SUB);
561 } else { 562 } else {
562 token = Token::SUB; 563 token = Token::SUB;
563 } 564 }
564 break; 565 break;
565 566
566 case '*': 567 case '*':
567 // * *= 568 // * *=
568 token = Select('=', Token::ASSIGN_MUL, Token::MUL); 569 Advance();
570 if (c0_ == '*' && allow_harmony_exponentiation_operator()) {
571 token = Select('=', Token::ASSIGN_EXP, Token::EXP);
572 } else if (c0_ == '=') {
573 token = Select(Token::ASSIGN_MUL);
574 } else {
575 token = Token::MUL;
576 }
569 break; 577 break;
570 578
571 case '%': 579 case '%':
572 // % %= 580 // % %=
573 token = Select('=', Token::ASSIGN_MOD, Token::MOD); 581 token = Select('=', Token::ASSIGN_MOD, Token::MOD);
574 break; 582 break;
575 583
576 case '/': 584 case '/':
577 // / // /* /= 585 // / // /* /=
578 Advance(); 586 Advance();
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); 1678 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u));
1671 } 1679 }
1672 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); 1680 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f));
1673 1681
1674 backing_store_.AddBlock(bytes); 1682 backing_store_.AddBlock(bytes);
1675 return backing_store_.EndSequence().start(); 1683 return backing_store_.EndSequence().start();
1676 } 1684 }
1677 1685
1678 } // namespace internal 1686 } // namespace internal
1679 } // namespace v8 1687 } // namespace v8
OLDNEW
« src/parsing/parser-base.h ('K') | « src/parsing/scanner.h ('k') | src/parsing/token.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698