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

Side by Side Diff: src/scanner-base.h

Issue 7207007: Proper handling of future reserved words in strict and normal mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/preparser.cc ('k') | src/scanner-base.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 bool has_multiline_comment_before_next_; 542 bool has_multiline_comment_before_next_;
543 }; 543 };
544 544
545 545
546 // ---------------------------------------------------------------------------- 546 // ----------------------------------------------------------------------------
547 // Keyword matching state machine. 547 // Keyword matching state machine.
548 548
549 class KeywordMatcher { 549 class KeywordMatcher {
550 // Incrementally recognize keywords. 550 // Incrementally recognize keywords.
551 // 551 //
552 // We distinguish between normal future reserved words and words that are
553 // considered to be future reserved words only in strict mode as required by
554 // ECMA-262 7.6.1.2.
555 //
552 // Recognized as keywords: 556 // Recognized as keywords:
553 // break, case, catch, const*, continue, debugger, default, delete, do, 557 // break, case, catch, const*, continue, debugger, default, delete, do,
554 // else, finally, false, for, function, if, in, instanceof, new, null, 558 // else, finally, false, for, function, if, in, instanceof, new, null,
555 // return, switch, this, throw, true, try, typeof, var, void, while, with. 559 // return, switch, this, throw, true, try, typeof, var, void, while, with.
556 // 560 //
557 // Recognized as Future Reserved Keywords (normal and strict mode): 561 // Recognized as Future Reserved Keywords:
558 // class, enum, export, extends, implements, import, interface, 562 // class, enum, export, extends, import, super.
559 // let, package, private, private, protected, public, public, 563 //
564 // Recognized as Future Reserved Keywords (strict mode only):
565 // implements, interface, let, package, private, protected, public,
560 // static, yield. 566 // static, yield.
561 // 567 //
562 // *: Actually a "future reserved keyword". It's the only one we are 568 // *: Actually a "future reserved keyword". It's the only one we are
563 // recognizing outside of ES5 strict mode, the remaining are allowed 569 // recognizing outside of ES5 strict mode, the remaining are allowed
564 // as identifiers. 570 // as identifiers.
565 // 571 //
566 public: 572 public:
567 KeywordMatcher() 573 KeywordMatcher()
568 : state_(INITIAL), 574 : state_(INITIAL),
569 token_(Token::IDENTIFIER), 575 token_(Token::IDENTIFIER),
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 // keyword with the current prefix). 683 // keyword with the current prefix).
678 const char* keyword_; 684 const char* keyword_;
679 int counter_; 685 int counter_;
680 Token::Value keyword_token_; 686 Token::Value keyword_token_;
681 }; 687 };
682 688
683 689
684 } } // namespace v8::internal 690 } } // namespace v8::internal
685 691
686 #endif // V8_SCANNER_BASE_H_ 692 #endif // V8_SCANNER_BASE_H_
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | src/scanner-base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698