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

Side by Side Diff: src/scanner.h

Issue 996223003: [es6] support template literals after MemberExpression (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: New tests, delete unneeded code, some comments Created 5 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
« no previous file with comments | « src/preparser.h ('k') | test/mjsunit/harmony/templates.js » ('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 #ifndef V8_SCANNER_H_ 7 #ifndef V8_SCANNER_H_
8 #define V8_SCANNER_H_ 8 #define V8_SCANNER_H_
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 525
526 // Literal buffer support 526 // Literal buffer support
527 inline void StartLiteral() { 527 inline void StartLiteral() {
528 LiteralBuffer* free_buffer = (current_.literal_chars == &literal_buffer1_) ? 528 LiteralBuffer* free_buffer = (current_.literal_chars == &literal_buffer1_) ?
529 &literal_buffer2_ : &literal_buffer1_; 529 &literal_buffer2_ : &literal_buffer1_;
530 free_buffer->Reset(); 530 free_buffer->Reset();
531 next_.literal_chars = free_buffer; 531 next_.literal_chars = free_buffer;
532 } 532 }
533 533
534 inline void StartRawLiteral() { 534 inline void StartRawLiteral() {
535 raw_literal_buffer_.Reset(); 535 LiteralBuffer* free_buffer =
536 next_.raw_literal_chars = &raw_literal_buffer_; 536 (current_.raw_literal_chars == &raw_literal_buffer1_) ?
537 &raw_literal_buffer2_ : &raw_literal_buffer1_;
538 free_buffer->Reset();
539 next_.raw_literal_chars = free_buffer;
537 } 540 }
538 541
539 INLINE(void AddLiteralChar(uc32 c)) { 542 INLINE(void AddLiteralChar(uc32 c)) {
540 DCHECK_NOT_NULL(next_.literal_chars); 543 DCHECK_NOT_NULL(next_.literal_chars);
541 next_.literal_chars->AddChar(c); 544 next_.literal_chars->AddChar(c);
542 } 545 }
543 546
544 INLINE(void AddRawLiteralChar(uc32 c)) { 547 INLINE(void AddRawLiteralChar(uc32 c)) {
545 DCHECK_NOT_NULL(next_.raw_literal_chars); 548 DCHECK_NOT_NULL(next_.raw_literal_chars);
546 next_.raw_literal_chars->AddChar(c); 549 next_.raw_literal_chars->AddChar(c);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 712
710 // Buffers collecting literal strings, numbers, etc. 713 // Buffers collecting literal strings, numbers, etc.
711 LiteralBuffer literal_buffer1_; 714 LiteralBuffer literal_buffer1_;
712 LiteralBuffer literal_buffer2_; 715 LiteralBuffer literal_buffer2_;
713 716
714 // Values parsed from magic comments. 717 // Values parsed from magic comments.
715 LiteralBuffer source_url_; 718 LiteralBuffer source_url_;
716 LiteralBuffer source_mapping_url_; 719 LiteralBuffer source_mapping_url_;
717 720
718 // Buffer to store raw string values 721 // Buffer to store raw string values
719 LiteralBuffer raw_literal_buffer_; 722 LiteralBuffer raw_literal_buffer1_;
723 LiteralBuffer raw_literal_buffer2_;
720 724
721 TokenDesc current_; // desc for current token (as returned by Next()) 725 TokenDesc current_; // desc for current token (as returned by Next())
722 TokenDesc next_; // desc for next token (one token look-ahead) 726 TokenDesc next_; // desc for next token (one token look-ahead)
723 727
724 // Input stream. Must be initialized to an Utf16CharacterStream. 728 // Input stream. Must be initialized to an Utf16CharacterStream.
725 Utf16CharacterStream* source_; 729 Utf16CharacterStream* source_;
726 730
727 731
728 // Start position of the octal literal last scanned. 732 // Start position of the octal literal last scanned.
729 Location octal_pos_; 733 Location octal_pos_;
(...skipping 21 matching lines...) Expand all
751 bool harmony_classes_; 755 bool harmony_classes_;
752 // Whether we scan TEMPLATE_SPAN and TEMPLATE_TAIL 756 // Whether we scan TEMPLATE_SPAN and TEMPLATE_TAIL
753 bool harmony_templates_; 757 bool harmony_templates_;
754 // Whether we allow \u{xxxxx}. 758 // Whether we allow \u{xxxxx}.
755 bool harmony_unicode_; 759 bool harmony_unicode_;
756 }; 760 };
757 761
758 } } // namespace v8::internal 762 } } // namespace v8::internal
759 763
760 #endif // V8_SCANNER_H_ 764 #endif // V8_SCANNER_H_
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | test/mjsunit/harmony/templates.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698