Index: src/parsing/scanner.h |
diff --git a/src/parsing/scanner.h b/src/parsing/scanner.h |
index b4c6b62d1488f5654869ca4e9bfedd2c03f79f1f..0238a0d4f32aeefd8a8fd139d2a1b416c822b702 100644 |
--- a/src/parsing/scanner.h |
+++ b/src/parsing/scanner.h |
@@ -371,6 +371,10 @@ class Scanner { |
Token::Value peek() const { return next_.token; } |
Location peek_location() const { return next_.location; } |
+ Location peek_ahead_location() const { |
+ DCHECK(next_next_.token != Token::UNINITIALIZED); |
+ return next_next_.location; |
+ } |
bool literal_contains_escapes() const { |
return LiteralContainsEscapes(current_); |
@@ -387,8 +391,14 @@ class Scanner { |
return next_.literal_chars->is_contextual_keyword(keyword); |
} |
+ bool is_next_next_contextual_keyword(Vector<const char> keyword) { |
+ DCHECK_NOT_NULL(next_next_.literal_chars); |
+ return next_next_.literal_chars->is_contextual_keyword(keyword); |
+ } |
+ |
const AstRawString* CurrentSymbol(AstValueFactory* ast_value_factory); |
const AstRawString* NextSymbol(AstValueFactory* ast_value_factory); |
+ const AstRawString* NextNextSymbol(AstValueFactory* ast_value_factory); |
const AstRawString* CurrentRawSymbol(AstValueFactory* ast_value_factory); |
double DoubleValue(); |
@@ -438,8 +448,13 @@ class Scanner { |
// Returns true if there was a line terminator before the peek'ed token, |
// possibly inside a multi-line comment. |
bool HasAnyLineTerminatorBeforeNext() const { |
- return has_line_terminator_before_next_ || |
- has_multiline_comment_before_next_; |
+ return has_preceding_line_terminator_ || has_preceding_multiline_comment_; |
+ } |
+ |
+ bool HasAnyLineTerminatorAfterNext() { |
+ Token::Value ensure_next_next = PeekAhead(); |
+ USE(ensure_next_next); |
+ return next_has_preceding_line_terminator_; |
} |
// Scans the input as a regular expression pattern, previous |
@@ -780,12 +795,11 @@ class Scanner { |
uc32 c0_; |
// Whether there is a line terminator whitespace character after |
- // the current token, and before the next. Does not count newlines |
- // inside multiline comments. |
- bool has_line_terminator_before_next_; |
- // Whether there is a multi-line comment that contains a |
- // line-terminator after the current token, and before the next. |
- bool has_multiline_comment_before_next_; |
+ // the current token, and before the next. |
+ bool has_preceding_line_terminator_; |
+ bool next_has_preceding_line_terminator_; |
+ |
+ bool has_preceding_multiline_comment_; |
// Whether this scanner encountered an HTML comment. |
bool found_html_comment_; |