Index: src/scanner.cc |
diff --git a/src/scanner.cc b/src/scanner.cc |
index 0265a8fa7810a797361e202f05dfd5ff045d11d1..e345e8353adc4e5a07db7b2c6c97465383715837 100644 |
--- a/src/scanner.cc |
+++ b/src/scanner.cc |
@@ -209,6 +209,7 @@ Token::Value Scanner::Next() { |
current_ = next_; |
has_line_terminator_before_next_ = false; |
has_multiline_comment_before_next_ = false; |
+ has_source_map_comment_ = false; |
if (static_cast<unsigned>(c0_) <= 0x7f) { |
Token::Value token = static_cast<Token::Value>(one_char_tokens[c0_]); |
if (token != Token::ILLEGAL) { |
@@ -294,6 +295,18 @@ Token::Value Scanner::SkipSingleLineComment() { |
} |
+Token::Value Scanner::SkipSourceMapComment() { |
+ Advance(); |
+ source_map_comment_.Reset(); |
+ while (c0_ >= 0 && !unicode_cache_->IsLineTerminator(c0_)) { |
+ source_map_comment_.AddChar(c0_); |
+ Advance(); |
+ } |
+ has_source_map_comment_ = true; |
+ return Token::WHITESPACE; |
+} |
+ |
+ |
Token::Value Scanner::SkipMultiLineComment() { |
ASSERT(c0_ == '*'); |
Advance(); |
@@ -458,7 +471,14 @@ void Scanner::Scan() { |
// / // /* /= |
Advance(); |
if (c0_ == '/') { |
- token = SkipSingleLineComment(); |
+ Advance(); |
+ if (c0_ == '@' || c0_ == '#') { |
+ Advance(); |
+ token = SkipSourceMapComment(); |
yurys
2014/06/05 13:55:21
I believe we should consider only sourceURL that a
|
+ } else { |
+ PushBack(c0_); |
+ token = SkipSingleLineComment(); |
+ } |
} else if (c0_ == '*') { |
token = SkipMultiLineComment(); |
} else if (c0_ == '=') { |
@@ -1093,6 +1113,17 @@ bool Scanner::ScanRegExpFlags() { |
} |
+Handle<String> Scanner::AllocateInternalizedSourceMapComment(Isolate* isolate) { |
+ if (source_map_comment_.is_one_byte()) { |
+ return isolate->factory()->InternalizeOneByteString( |
+ source_map_comment_.one_byte_literal()); |
+ } else { |
+ return isolate->factory()->InternalizeTwoByteString( |
+ source_map_comment_.two_byte_literal()); |
+ } |
+} |
+ |
+ |
Handle<String> Scanner::AllocateNextLiteralString(Isolate* isolate, |
PretenureFlag tenured) { |
if (is_next_literal_one_byte()) { |