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

Side by Side Diff: src/scanner.h

Issue 663683006: Implement ES6 Template Literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased against https://chromium.googlesource.com/v8/v8.git/master Created 6 years, 1 month 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
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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 } 451 }
452 void SetHarmonyNumericLiterals(bool numeric_literals) { 452 void SetHarmonyNumericLiterals(bool numeric_literals) {
453 harmony_numeric_literals_ = numeric_literals; 453 harmony_numeric_literals_ = numeric_literals;
454 } 454 }
455 bool HarmonyClasses() const { 455 bool HarmonyClasses() const {
456 return harmony_classes_; 456 return harmony_classes_;
457 } 457 }
458 void SetHarmonyClasses(bool classes) { 458 void SetHarmonyClasses(bool classes) {
459 harmony_classes_ = classes; 459 harmony_classes_ = classes;
460 } 460 }
461 bool HarmonyTemplates() const { return harmony_templates_; }
462 void SetHarmonyTemplates(bool templates) { harmony_templates_ = templates; }
461 463
462 // Returns true if there was a line terminator before the peek'ed token, 464 // Returns true if there was a line terminator before the peek'ed token,
463 // possibly inside a multi-line comment. 465 // possibly inside a multi-line comment.
464 bool HasAnyLineTerminatorBeforeNext() const { 466 bool HasAnyLineTerminatorBeforeNext() const {
465 return has_line_terminator_before_next_ || 467 return has_line_terminator_before_next_ ||
466 has_multiline_comment_before_next_; 468 has_multiline_comment_before_next_;
467 } 469 }
468 470
469 // Scans the input as a regular expression pattern, previous 471 // Scans the input as a regular expression pattern, previous
470 // character(s) must be /(=). Returns true if a pattern is scanned. 472 // character(s) must be /(=). Returns true if a pattern is scanned.
471 bool ScanRegExpPattern(bool seen_equal); 473 bool ScanRegExpPattern(bool seen_equal);
472 // Returns true if regexp flags are scanned (always since flags can 474 // Returns true if regexp flags are scanned (always since flags can
473 // be empty). 475 // be empty).
474 bool ScanRegExpFlags(); 476 bool ScanRegExpFlags();
475 477
478 // Scans the input as a template literal
479 Token::Value ScanTemplateSpan();
480
476 const LiteralBuffer* source_url() const { return &source_url_; } 481 const LiteralBuffer* source_url() const { return &source_url_; }
477 const LiteralBuffer* source_mapping_url() const { 482 const LiteralBuffer* source_mapping_url() const {
478 return &source_mapping_url_; 483 return &source_mapping_url_;
479 } 484 }
480 485
481 bool IdentifierIsFutureStrictReserved(const AstRawString* string) const; 486 bool IdentifierIsFutureStrictReserved(const AstRawString* string) const;
482 487
483 private: 488 private:
484 // The current and look-ahead token. 489 // The current and look-ahead token.
485 struct TokenDesc { 490 struct TokenDesc {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 // line-terminator after the current token, and before the next. 679 // line-terminator after the current token, and before the next.
675 bool has_multiline_comment_before_next_; 680 bool has_multiline_comment_before_next_;
676 // Whether we scan 'let' as a keyword for harmony block-scoped let bindings. 681 // Whether we scan 'let' as a keyword for harmony block-scoped let bindings.
677 bool harmony_scoping_; 682 bool harmony_scoping_;
678 // Whether we scan 'module', 'import', 'export' as keywords. 683 // Whether we scan 'module', 'import', 'export' as keywords.
679 bool harmony_modules_; 684 bool harmony_modules_;
680 // Whether we scan 0o777 and 0b111 as numbers. 685 // Whether we scan 0o777 and 0b111 as numbers.
681 bool harmony_numeric_literals_; 686 bool harmony_numeric_literals_;
682 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. 687 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords.
683 bool harmony_classes_; 688 bool harmony_classes_;
689 // Whether we scan TEMPLATE_SPAN and TEMPLATE_TAIL
690 bool harmony_templates_;
684 }; 691 };
685 692
686 } } // namespace v8::internal 693 } } // namespace v8::internal
687 694
688 #endif // V8_SCANNER_H_ 695 #endif // V8_SCANNER_H_
OLDNEW
« src/preparser.h ('K') | « src/preparser.h ('k') | src/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698