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

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

Issue 7211013: Combined identical classes V8JavaScriptScanner and StandAloneJavaScriptScanner. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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/scanner.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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 complete_ = true; 464 complete_ = true;
465 } 465 }
466 466
467 private: 467 private:
468 JavaScriptScanner* scanner_; 468 JavaScriptScanner* scanner_;
469 bool complete_; 469 bool complete_;
470 }; 470 };
471 471
472 explicit JavaScriptScanner(UnicodeCache* scanner_contants); 472 explicit JavaScriptScanner(UnicodeCache* scanner_contants);
473 473
474 void Initialize(UC16CharacterStream* source);
475
474 // Returns the next token. 476 // Returns the next token.
475 Token::Value Next(); 477 Token::Value Next();
476 478
477 // Returns true if there was a line terminator before the peek'ed token. 479 // Returns true if there was a line terminator before the peek'ed token.
478 bool has_line_terminator_before_next() const { 480 bool has_line_terminator_before_next() const {
479 return has_line_terminator_before_next_; 481 return has_line_terminator_before_next_;
480 } 482 }
481 483
482 // Scans the input as a regular expression pattern, previous 484 // Scans the input as a regular expression pattern, previous
483 // character(s) must be /(=). Returns true if a pattern is scanned. 485 // character(s) must be /(=). Returns true if a pattern is scanned.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 bool has_line_terminator_before_next_; 534 bool has_line_terminator_before_next_;
533 }; 535 };
534 536
535 537
536 // ---------------------------------------------------------------------------- 538 // ----------------------------------------------------------------------------
537 // Keyword matching state machine. 539 // Keyword matching state machine.
538 540
539 class KeywordMatcher { 541 class KeywordMatcher {
540 // Incrementally recognize keywords. 542 // Incrementally recognize keywords.
541 // 543 //
542 // Recognized keywords: 544 // Recognized as keywords:
543 // break case catch const* continue debugger* default delete do else 545 // break, case, catch, const*, continue, debugger, default, delete, do,
544 // finally false for function if in instanceof native* new null 546 // else, finally, false, for, function, if, in, instanceof, new, null,
545 // return switch this throw true try typeof var void while with 547 // return, switch, this, throw, true, try, typeof, var, void, while, with.
546 // 548 //
547 // *: Actually "future reserved keywords". These are the only ones we 549 // Recognized as Future Reserved Keywords (normal and strict mode):
548 // recognize, the remaining are allowed as identifiers. 550 // class, enum, export, extends, implements, import, interface,
549 // In ES5 strict mode, we should disallow all reserved keywords. 551 // let, package, private, private, protected, public, public,
552 // static, yield.
553 //
554 // *: Actually a "future reserved keyword". It's the only one we are
555 // recognizing outside of ES5 strict mode, the remaining are allowed
556 // as identifiers.
557 //
550 public: 558 public:
551 KeywordMatcher() 559 KeywordMatcher()
552 : state_(INITIAL), 560 : state_(INITIAL),
553 token_(Token::IDENTIFIER), 561 token_(Token::IDENTIFIER),
554 keyword_(NULL), 562 keyword_(NULL),
555 counter_(0), 563 counter_(0),
556 keyword_token_(Token::ILLEGAL) {} 564 keyword_token_(Token::ILLEGAL) {}
557 565
558 Token::Value token() { return token_; } 566 Token::Value token() { return token_; }
559 567
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 // keyword with the current prefix). 669 // keyword with the current prefix).
662 const char* keyword_; 670 const char* keyword_;
663 int counter_; 671 int counter_;
664 Token::Value keyword_token_; 672 Token::Value keyword_token_;
665 }; 673 };
666 674
667 675
668 } } // namespace v8::internal 676 } } // namespace v8::internal
669 677
670 #endif // V8_SCANNER_BASE_H_ 678 #endif // V8_SCANNER_BASE_H_
OLDNEW
« no previous file with comments | « src/scanner.cc ('k') | src/scanner-base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698