OLD | NEW |
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 23 matching lines...) Expand all Loading... |
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 decimal_with_leading_zero_pos_(Location::invalid()), | 43 decimal_with_leading_zero_pos_(Location::invalid()), |
44 found_html_comment_(false), | 44 found_html_comment_(false) { |
45 allow_harmony_exponentiation_operator_(false) { | |
46 bookmark_current_.literal_chars = &bookmark_current_literal_; | 45 bookmark_current_.literal_chars = &bookmark_current_literal_; |
47 bookmark_current_.raw_literal_chars = &bookmark_current_raw_literal_; | 46 bookmark_current_.raw_literal_chars = &bookmark_current_raw_literal_; |
48 bookmark_next_.literal_chars = &bookmark_next_literal_; | 47 bookmark_next_.literal_chars = &bookmark_next_literal_; |
49 bookmark_next_.raw_literal_chars = &bookmark_next_raw_literal_; | 48 bookmark_next_.raw_literal_chars = &bookmark_next_raw_literal_; |
50 } | 49 } |
51 | 50 |
52 | 51 |
53 void Scanner::Initialize(Utf16CharacterStream* source) { | 52 void Scanner::Initialize(Utf16CharacterStream* source) { |
54 source_ = source; | 53 source_ = source; |
55 // Need to capture identifiers in order to recognize "get" and "set" | 54 // Need to capture identifiers in order to recognize "get" and "set" |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 } else if (c0_ == '=') { | 573 } else if (c0_ == '=') { |
575 token = Select(Token::ASSIGN_SUB); | 574 token = Select(Token::ASSIGN_SUB); |
576 } else { | 575 } else { |
577 token = Token::SUB; | 576 token = Token::SUB; |
578 } | 577 } |
579 break; | 578 break; |
580 | 579 |
581 case '*': | 580 case '*': |
582 // * *= | 581 // * *= |
583 Advance(); | 582 Advance(); |
584 if (c0_ == '*' && allow_harmony_exponentiation_operator()) { | 583 if (c0_ == '*') { |
585 token = Select('=', Token::ASSIGN_EXP, Token::EXP); | 584 token = Select('=', Token::ASSIGN_EXP, Token::EXP); |
586 } else if (c0_ == '=') { | 585 } else if (c0_ == '=') { |
587 token = Select(Token::ASSIGN_MUL); | 586 token = Select(Token::ASSIGN_MUL); |
588 } else { | 587 } else { |
589 token = Token::MUL; | 588 token = Token::MUL; |
590 } | 589 } |
591 break; | 590 break; |
592 | 591 |
593 case '%': | 592 case '%': |
594 // % %= | 593 // % %= |
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); | 1704 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); |
1706 } | 1705 } |
1707 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); | 1706 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); |
1708 | 1707 |
1709 backing_store_.AddBlock(bytes); | 1708 backing_store_.AddBlock(bytes); |
1710 return backing_store_.EndSequence().start(); | 1709 return backing_store_.EndSequence().start(); |
1711 } | 1710 } |
1712 | 1711 |
1713 } // namespace internal | 1712 } // namespace internal |
1714 } // namespace v8 | 1713 } // namespace v8 |
OLD | NEW |