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

Unified Diff: src/scanner.cc

Issue 1295883002: Sloppy-mode let parsing (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More sloppy let tests Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« src/scanner.h ('K') | « src/scanner.h ('k') | src/token.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.cc
diff --git a/src/scanner.cc b/src/scanner.cc
index c6c0a8d6a23448b7be244224ec48bc5b37b16cee..1823a521364873c63e89971f0cbe538b200af09c 100644
--- a/src/scanner.cc
+++ b/src/scanner.cc
@@ -238,6 +238,11 @@ Token::Value Scanner::Next() {
next_.location.end_pos = current_.location.end_pos;
}
current_ = next_;
+ if (uber_next_.token != Token::UNINITIALIZED) {
+ next_ = uber_next_;
+ uber_next_.token = Token::UNINITIALIZED;
+ return current_.token;
+ }
has_line_terminator_before_next_ = false;
has_multiline_comment_before_next_ = false;
if (static_cast<unsigned>(c0_) <= 0x7f) {
@@ -256,6 +261,20 @@ Token::Value Scanner::Next() {
}
+Token::Value Scanner::PeekAhead() {
+ if (uber_next_.token != Token::UNINITIALIZED) {
+ return uber_next_.token;
+ }
+ TokenDesc prev = current_;
+ Next();
+ Token::Value ret = next_.token;
+ uber_next_ = next_;
+ next_ = current_;
+ current_ = prev;
+ return ret;
+}
+
+
// TODO(yangguo): check whether this is actually necessary.
static inline bool IsLittleEndianByteOrderMark(uc32 c) {
// The Unicode value U+FFFE is guaranteed never to be assigned as a
« src/scanner.h ('K') | « src/scanner.h ('k') | src/token.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698