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

Side by Side Diff: src/scanner.h

Issue 778813003: ES6 template literals: Fix issue with template after rbrace (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add tests without newlines Created 6 years 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') | src/scanner.cc » ('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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 477 }
478 478
479 // Scans the input as a regular expression pattern, previous 479 // Scans the input as a regular expression pattern, previous
480 // character(s) must be /(=). Returns true if a pattern is scanned. 480 // character(s) must be /(=). Returns true if a pattern is scanned.
481 bool ScanRegExpPattern(bool seen_equal); 481 bool ScanRegExpPattern(bool seen_equal);
482 // Returns true if regexp flags are scanned (always since flags can 482 // Returns true if regexp flags are scanned (always since flags can
483 // be empty). 483 // be empty).
484 bool ScanRegExpFlags(); 484 bool ScanRegExpFlags();
485 485
486 // Scans the input as a template literal 486 // Scans the input as a template literal
487 Token::Value ScanTemplateSpan(); 487 Token::Value ScanTemplateStart();
488 Token::Value ScanTemplateContinuation();
488 489
489 const LiteralBuffer* source_url() const { return &source_url_; } 490 const LiteralBuffer* source_url() const { return &source_url_; }
490 const LiteralBuffer* source_mapping_url() const { 491 const LiteralBuffer* source_mapping_url() const {
491 return &source_mapping_url_; 492 return &source_mapping_url_;
492 } 493 }
493 494
494 bool IdentifierIsFutureStrictReserved(const AstRawString* string) const; 495 bool IdentifierIsFutureStrictReserved(const AstRawString* string) const;
495 496
496 private: 497 private:
497 // The current and look-ahead token. 498 // The current and look-ahead token.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 // Scans an escape-sequence which is part of a string and adds the 686 // Scans an escape-sequence which is part of a string and adds the
686 // decoded character to the current literal. Returns true if a pattern 687 // decoded character to the current literal. Returns true if a pattern
687 // is scanned. 688 // is scanned.
688 bool ScanEscape(); 689 bool ScanEscape();
689 // Decodes a Unicode escape-sequence which is part of an identifier. 690 // Decodes a Unicode escape-sequence which is part of an identifier.
690 // If the escape sequence cannot be decoded the result is kBadChar. 691 // If the escape sequence cannot be decoded the result is kBadChar.
691 uc32 ScanIdentifierUnicodeEscape(); 692 uc32 ScanIdentifierUnicodeEscape();
692 // Helper for the above functions. 693 // Helper for the above functions.
693 uc32 ScanUnicodeEscape(); 694 uc32 ScanUnicodeEscape();
694 695
696 Token::Value ScanTemplateSpan();
697
695 // Return the current source position. 698 // Return the current source position.
696 int source_pos() { 699 int source_pos() {
697 return source_->pos() - kCharacterLookaheadBufferSize; 700 return source_->pos() - kCharacterLookaheadBufferSize;
698 } 701 }
699 702
700 UnicodeCache* unicode_cache_; 703 UnicodeCache* unicode_cache_;
701 704
702 // Buffers collecting literal strings, numbers, etc. 705 // Buffers collecting literal strings, numbers, etc.
703 LiteralBuffer literal_buffer1_; 706 LiteralBuffer literal_buffer1_;
704 LiteralBuffer literal_buffer2_; 707 LiteralBuffer literal_buffer2_;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 bool harmony_classes_; 747 bool harmony_classes_;
745 // Whether we scan TEMPLATE_SPAN and TEMPLATE_TAIL 748 // Whether we scan TEMPLATE_SPAN and TEMPLATE_TAIL
746 bool harmony_templates_; 749 bool harmony_templates_;
747 // Whether we allow \u{xxxxx}. 750 // Whether we allow \u{xxxxx}.
748 bool harmony_unicode_; 751 bool harmony_unicode_;
749 }; 752 };
750 753
751 } } // namespace v8::internal 754 } } // namespace v8::internal
752 755
753 #endif // V8_SCANNER_H_ 756 #endif // V8_SCANNER_H_
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | src/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698