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

Unified Diff: src/scanner.h

Issue 1295883002: Sloppy-mode let parsing (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Replace array with direct ivars 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
« no previous file with comments | « src/preparser.cc ('k') | src/scanner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.h
diff --git a/src/scanner.h b/src/scanner.h
index 92588905ad609b7ea64d8c5c7c2007d3e55d409b..8ee8d0208a3a219749994803e0ceef22595bf906 100644
--- a/src/scanner.h
+++ b/src/scanner.h
@@ -399,6 +399,8 @@ class Scanner {
// Returns the next token and advances input.
Token::Value Next();
+ // Returns the token following peek()
+ Token::Value PeekAhead();
// Returns the current token again.
Token::Value current_token() { return current_.token; }
// Returns the location information for the current token
@@ -527,6 +529,7 @@ class Scanner {
// Initialize current_ to not refer to a literal.
current_.literal_chars = NULL;
current_.raw_literal_chars = NULL;
+ next_next_.token = Token::UNINITIALIZED;
}
// Support BookmarkScope functionality.
@@ -539,16 +542,22 @@ class Scanner {
// Literal buffer support
inline void StartLiteral() {
- LiteralBuffer* free_buffer = (current_.literal_chars == &literal_buffer1_) ?
- &literal_buffer2_ : &literal_buffer1_;
+ LiteralBuffer* free_buffer =
+ (current_.literal_chars == &literal_buffer0_)
+ ? &literal_buffer1_
+ : (current_.literal_chars == &literal_buffer1_) ? &literal_buffer2_
+ : &literal_buffer0_;
free_buffer->Reset();
next_.literal_chars = free_buffer;
}
inline void StartRawLiteral() {
LiteralBuffer* free_buffer =
- (current_.raw_literal_chars == &raw_literal_buffer1_) ?
- &raw_literal_buffer2_ : &raw_literal_buffer1_;
+ (current_.raw_literal_chars == &raw_literal_buffer0_)
+ ? &raw_literal_buffer1_
+ : (current_.raw_literal_chars == &raw_literal_buffer1_)
+ ? &raw_literal_buffer2_
+ : &raw_literal_buffer0_;
free_buffer->Reset();
next_.raw_literal_chars = free_buffer;
}
@@ -725,6 +734,7 @@ class Scanner {
UnicodeCache* unicode_cache_;
// Buffers collecting literal strings, numbers, etc.
+ LiteralBuffer literal_buffer0_;
LiteralBuffer literal_buffer1_;
LiteralBuffer literal_buffer2_;
@@ -733,11 +743,13 @@ class Scanner {
LiteralBuffer source_mapping_url_;
// Buffer to store raw string values
+ LiteralBuffer raw_literal_buffer0_;
LiteralBuffer raw_literal_buffer1_;
LiteralBuffer raw_literal_buffer2_;
- TokenDesc current_; // desc for current token (as returned by Next())
- TokenDesc next_; // desc for next token (one token look-ahead)
+ TokenDesc current_; // desc for current token (as returned by Next())
+ TokenDesc next_; // desc for next token (one token look-ahead)
+ TokenDesc next_next_; // desc for the token after next (push-back)
// Variables for Scanner::BookmarkScope and the *Bookmark implementation.
// These variables contain the scanner state when a bookmark is set.
« no previous file with comments | « src/preparser.cc ('k') | src/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698