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

Side by Side Diff: src/scanner.cc

Issue 1481513002: Revert of Removed support deprecated (//@|/*@) source(URL|MappingURL)= (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/js/messages.js ('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/scanner.h" 7 #include "src/scanner.h"
8 8
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 TryToParseSourceURLComment(); 349 TryToParseSourceURLComment();
350 while (c0_ >= 0 && !unicode_cache_->IsLineTerminator(c0_)) { 350 while (c0_ >= 0 && !unicode_cache_->IsLineTerminator(c0_)) {
351 Advance(); 351 Advance();
352 } 352 }
353 353
354 return Token::WHITESPACE; 354 return Token::WHITESPACE;
355 } 355 }
356 356
357 357
358 void Scanner::TryToParseSourceURLComment() { 358 void Scanner::TryToParseSourceURLComment() {
359 // Magic comments are of the form: //[#]\s<name>=\s*<value>\s*.* and this 359 // Magic comments are of the form: //[#@]\s<name>=\s*<value>\s*.* and this
360 // function will just return if it cannot parse a magic comment. 360 // function will just return if it cannot parse a magic comment.
361 if (c0_ < 0 || !unicode_cache_->IsWhiteSpace(c0_)) return; 361 if (c0_ < 0 || !unicode_cache_->IsWhiteSpace(c0_)) return;
362 Advance(); 362 Advance();
363 LiteralBuffer name; 363 LiteralBuffer name;
364 while (c0_ >= 0 && !unicode_cache_->IsWhiteSpaceOrLineTerminator(c0_) && 364 while (c0_ >= 0 && !unicode_cache_->IsWhiteSpaceOrLineTerminator(c0_) &&
365 c0_ != '=') { 365 c0_ != '=') {
366 name.AddChar(c0_); 366 name.AddChar(c0_);
367 Advance(); 367 Advance();
368 } 368 }
369 if (!name.is_one_byte()) return; 369 if (!name.is_one_byte()) return;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 case '%': 567 case '%':
568 // % %= 568 // % %=
569 token = Select('=', Token::ASSIGN_MOD, Token::MOD); 569 token = Select('=', Token::ASSIGN_MOD, Token::MOD);
570 break; 570 break;
571 571
572 case '/': 572 case '/':
573 // / // /* /= 573 // / // /* /=
574 Advance(); 574 Advance();
575 if (c0_ == '/') { 575 if (c0_ == '/') {
576 Advance(); 576 Advance();
577 if (c0_ == '#') { 577 if (c0_ == '@' || c0_ == '#') {
578 Advance(); 578 Advance();
579 token = SkipSourceURLComment(); 579 token = SkipSourceURLComment();
580 } else { 580 } else {
581 PushBack(c0_); 581 PushBack(c0_);
582 token = SkipSingleLineComment(); 582 token = SkipSingleLineComment();
583 } 583 }
584 } else if (c0_ == '*') { 584 } else if (c0_ == '*') {
585 token = SkipMultiLineComment(); 585 token = SkipMultiLineComment();
586 } else if (c0_ == '=') { 586 } else if (c0_ == '=') {
587 token = Select(Token::ASSIGN_DIV); 587 token = Select(Token::ASSIGN_DIV);
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); 1643 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u));
1644 } 1644 }
1645 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); 1645 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f));
1646 1646
1647 backing_store_.AddBlock(bytes); 1647 backing_store_.AddBlock(bytes);
1648 return backing_store_.EndSequence().start(); 1648 return backing_store_.EndSequence().start();
1649 } 1649 }
1650 1650
1651 } // namespace internal 1651 } // namespace internal
1652 } // namespace v8 1652 } // namespace v8
OLDNEW
« no previous file with comments | « src/js/messages.js ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698