| OLD | NEW |
| 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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 | 1171 |
| 1172 | 1172 |
| 1173 Token::Value Scanner::ScanTemplateStart() { | 1173 Token::Value Scanner::ScanTemplateStart() { |
| 1174 DCHECK(next_next_.token == Token::UNINITIALIZED); | 1174 DCHECK(next_next_.token == Token::UNINITIALIZED); |
| 1175 DCHECK(c0_ == '`'); | 1175 DCHECK(c0_ == '`'); |
| 1176 next_.location.beg_pos = source_pos(); | 1176 next_.location.beg_pos = source_pos(); |
| 1177 Advance(); // Consume ` | 1177 Advance(); // Consume ` |
| 1178 return ScanTemplateSpan(); | 1178 return ScanTemplateSpan(); |
| 1179 } | 1179 } |
| 1180 | 1180 |
| 1181 |
| 1182 Token::Value Scanner::ScanTemplateContinuation() { |
| 1183 DCHECK_EQ(next_.token, Token::RBRACE); |
| 1184 next_.location.beg_pos = source_pos() - 1; // We already consumed } |
| 1185 return ScanTemplateSpan(); |
| 1186 } |
| 1187 |
| 1181 Handle<String> Scanner::SourceUrl(Isolate* isolate) const { | 1188 Handle<String> Scanner::SourceUrl(Isolate* isolate) const { |
| 1182 Handle<String> tmp; | 1189 Handle<String> tmp; |
| 1183 if (source_url_.length() > 0) tmp = source_url_.Internalize(isolate); | 1190 if (source_url_.length() > 0) tmp = source_url_.Internalize(isolate); |
| 1184 return tmp; | 1191 return tmp; |
| 1185 } | 1192 } |
| 1186 | 1193 |
| 1187 Handle<String> Scanner::SourceMappingUrl(Isolate* isolate) const { | 1194 Handle<String> Scanner::SourceMappingUrl(Isolate* isolate) const { |
| 1188 Handle<String> tmp; | 1195 Handle<String> tmp; |
| 1189 if (source_mapping_url_.length() > 0) | 1196 if (source_mapping_url_.length() > 0) |
| 1190 tmp = source_mapping_url_.Internalize(isolate); | 1197 tmp = source_mapping_url_.Internalize(isolate); |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 // 2, reset the source to the desired position, | 1807 // 2, reset the source to the desired position, |
| 1801 source_->Seek(position); | 1808 source_->Seek(position); |
| 1802 // 3, re-scan, by scanning the look-ahead char + 1 token (next_). | 1809 // 3, re-scan, by scanning the look-ahead char + 1 token (next_). |
| 1803 c0_ = source_->Advance(); | 1810 c0_ = source_->Advance(); |
| 1804 Next(); | 1811 Next(); |
| 1805 DCHECK_EQ(next_.location.beg_pos, static_cast<int>(position)); | 1812 DCHECK_EQ(next_.location.beg_pos, static_cast<int>(position)); |
| 1806 } | 1813 } |
| 1807 | 1814 |
| 1808 } // namespace internal | 1815 } // namespace internal |
| 1809 } // namespace v8 | 1816 } // namespace v8 |
| OLD | NEW |