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

Unified Diff: src/parsing/scanner.cc

Issue 1801203002: Parser: Make skipping HTML comments optional. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
Index: src/parsing/scanner.cc
diff --git a/src/parsing/scanner.cc b/src/parsing/scanner.cc
index 2d5a57958336ef1ec4bb65b8ce63da1efc199a3e..8a6522e52796932a5f0acb1ce76e8be89fedfd71 100644
--- a/src/parsing/scanner.cc
+++ b/src/parsing/scanner.cc
@@ -36,10 +36,11 @@ void Utf16CharacterStream::ResetToBookmark() { UNREACHABLE(); }
// ----------------------------------------------------------------------------
// Scanner
-Scanner::Scanner(UnicodeCache* unicode_cache)
+Scanner::Scanner(UnicodeCache* unicode_cache, bool ignore_html_comments)
: unicode_cache_(unicode_cache),
bookmark_c0_(kNoBookmark),
octal_pos_(Location::invalid()),
+ ignore_html_comments_(ignore_html_comments),
found_html_comment_(false) {
bookmark_current_.literal_chars = &bookmark_current_literal_;
bookmark_current_.raw_literal_chars = &bookmark_current_raw_literal_;
@@ -483,7 +484,7 @@ void Scanner::Scan() {
token = Select(Token::LTE);
} else if (c0_ == '<') {
token = Select('=', Token::ASSIGN_SHL, Token::SHL);
- } else if (c0_ == '!') {
+ } else if (c0_ == '!' && ignore_html_comments_) {
token = ScanHtmlComment();
} else {
token = Token::LT;
« src/compiler.cc ('K') | « src/parsing/scanner.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698