Commit 1a8f24d8 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[scanner] Only find newlines in whitespace once

Change-Id: I14fd9d439db70cc37b8a57a8bc13e09877c513ee
Reviewed-on: https://chromium-review.googlesource.com/1195369
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55493}
parent e5cf8e37
......@@ -152,16 +152,13 @@ static const Token::Value one_char_tokens[] = {
V8_INLINE Token::Value Scanner::SkipWhiteSpace() {
int start_position = source_pos();
while (true) {
// We won't skip behind the end of input.
DCHECK(!unicode_cache_->IsWhiteSpace(kEndOfInput));
DCHECK(!unicode_cache_->IsWhiteSpaceOrLineTerminator(kEndOfInput));
// Advance as long as character is a WhiteSpace or LineTerminator.
// Remember if the latter is the case.
if (unibrow::IsLineTerminator(c0_)) {
while (unicode_cache_->IsWhiteSpaceOrLineTerminator(c0_)) {
if (!next().after_line_terminator && unibrow::IsLineTerminator(c0_)) {
next().after_line_terminator = true;
} else if (!unicode_cache_->IsWhiteSpace(c0_)) {
break;
}
Advance();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment