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

Side by Side Diff: src/parsing/scanner.cc

Issue 1817163003: Revert of 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 unified diff | Download patch
« no previous file with comments | « src/parsing/scanner.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Features shared by parsing and pre-parsing scanners. 5 // Features shared by parsing and pre-parsing scanners.
6 6
7 #include "src/parsing/scanner.h" 7 #include "src/parsing/scanner.h"
8 8
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 30
31 // Default implementation for streams that do not support bookmarks. 31 // Default implementation for streams that do not support bookmarks.
32 bool Utf16CharacterStream::SetBookmark() { return false; } 32 bool Utf16CharacterStream::SetBookmark() { return false; }
33 void Utf16CharacterStream::ResetToBookmark() { UNREACHABLE(); } 33 void Utf16CharacterStream::ResetToBookmark() { UNREACHABLE(); }
34 34
35 35
36 // ---------------------------------------------------------------------------- 36 // ----------------------------------------------------------------------------
37 // Scanner 37 // Scanner
38 38
39 Scanner::Scanner(UnicodeCache* unicode_cache, bool allow_html_comments) 39 Scanner::Scanner(UnicodeCache* unicode_cache)
40 : unicode_cache_(unicode_cache), 40 : unicode_cache_(unicode_cache),
41 bookmark_c0_(kNoBookmark), 41 bookmark_c0_(kNoBookmark),
42 octal_pos_(Location::invalid()), 42 octal_pos_(Location::invalid()),
43 allow_html_comments_(allow_html_comments),
44 found_html_comment_(false), 43 found_html_comment_(false),
45 allow_harmony_exponentiation_operator_(false) { 44 allow_harmony_exponentiation_operator_(false) {
46 bookmark_current_.literal_chars = &bookmark_current_literal_; 45 bookmark_current_.literal_chars = &bookmark_current_literal_;
47 bookmark_current_.raw_literal_chars = &bookmark_current_raw_literal_; 46 bookmark_current_.raw_literal_chars = &bookmark_current_raw_literal_;
48 bookmark_next_.literal_chars = &bookmark_next_literal_; 47 bookmark_next_.literal_chars = &bookmark_next_literal_;
49 bookmark_next_.raw_literal_chars = &bookmark_next_raw_literal_; 48 bookmark_next_.raw_literal_chars = &bookmark_next_raw_literal_;
50 } 49 }
51 50
52 51
53 void Scanner::Initialize(Utf16CharacterStream* source) { 52 void Scanner::Initialize(Utf16CharacterStream* source) {
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 token = ScanString(); 477 token = ScanString();
479 break; 478 break;
480 479
481 case '<': 480 case '<':
482 // < <= << <<= <!-- 481 // < <= << <<= <!--
483 Advance(); 482 Advance();
484 if (c0_ == '=') { 483 if (c0_ == '=') {
485 token = Select(Token::LTE); 484 token = Select(Token::LTE);
486 } else if (c0_ == '<') { 485 } else if (c0_ == '<') {
487 token = Select('=', Token::ASSIGN_SHL, Token::SHL); 486 token = Select('=', Token::ASSIGN_SHL, Token::SHL);
488 } else if (c0_ == '!' && allow_html_comments_) { 487 } else if (c0_ == '!') {
489 token = ScanHtmlComment(); 488 token = ScanHtmlComment();
490 } else { 489 } else {
491 token = Token::LT; 490 token = Token::LT;
492 } 491 }
493 break; 492 break;
494 493
495 case '>': 494 case '>':
496 // > >= >> >>= >>> >>>= 495 // > >= >> >>= >>> >>>=
497 Advance(); 496 Advance();
498 if (c0_ == '=') { 497 if (c0_ == '=') {
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); 1678 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u));
1680 } 1679 }
1681 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); 1680 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f));
1682 1681
1683 backing_store_.AddBlock(bytes); 1682 backing_store_.AddBlock(bytes);
1684 return backing_store_.EndSequence().start(); 1683 return backing_store_.EndSequence().start();
1685 } 1684 }
1686 1685
1687 } // namespace internal 1686 } // namespace internal
1688 } // namespace v8 1687 } // namespace v8
OLDNEW
« no previous file with comments | « 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