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 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1154 DCHECK(next_next_.token == Token::UNINITIALIZED); | 1154 DCHECK(next_next_.token == Token::UNINITIALIZED); |
1155 DCHECK(c0_ == '`'); | 1155 DCHECK(c0_ == '`'); |
1156 next_.location.beg_pos = source_pos(); | 1156 next_.location.beg_pos = source_pos(); |
1157 Advance(); // Consume ` | 1157 Advance(); // Consume ` |
1158 return ScanTemplateSpan(); | 1158 return ScanTemplateSpan(); |
1159 } | 1159 } |
1160 | 1160 |
1161 | 1161 |
1162 Token::Value Scanner::ScanTemplateContinuation() { | 1162 Token::Value Scanner::ScanTemplateContinuation() { |
1163 DCHECK_EQ(next_.token, Token::RBRACE); | 1163 DCHECK_EQ(next_.token, Token::RBRACE); |
1164 next_.location.beg_pos = source_pos() - 1; // We already consumed } | 1164 next_.location.beg_pos = source_pos() - 2; // We already consumed } |
vogelheim
2017/03/16 12:46:48
wut? I don't understand this change.
bradn
2017/03/16 17:03:15
Mismatch on my two branches, removed.
| |
1165 return ScanTemplateSpan(); | 1165 return ScanTemplateSpan(); |
1166 } | 1166 } |
1167 | 1167 |
1168 Handle<String> Scanner::SourceUrl(Isolate* isolate) const { | |
vogelheim
2017/03/16 12:46:48
Is this because we previously relied on v8::intern
bradn
2017/03/16 17:03:15
Yep.
| |
1169 Handle<String> tmp; | |
1170 if (source_url_.length() > 0) tmp = source_url_.Internalize(isolate); | |
1171 return tmp; | |
1172 } | |
1173 | |
1174 Handle<String> Scanner::SourceMappingUrl(Isolate* isolate) const { | |
1175 Handle<String> tmp; | |
1176 if (source_mapping_url_.length() > 0) | |
1177 tmp = source_mapping_url_.Internalize(isolate); | |
1178 return tmp; | |
1179 } | |
1168 | 1180 |
1169 void Scanner::ScanDecimalDigits() { | 1181 void Scanner::ScanDecimalDigits() { |
1170 while (IsDecimalDigit(c0_)) | 1182 while (IsDecimalDigit(c0_)) |
1171 AddLiteralCharAdvance(); | 1183 AddLiteralCharAdvance(); |
1172 } | 1184 } |
1173 | 1185 |
1174 | 1186 |
1175 Token::Value Scanner::ScanNumber(bool seen_period) { | 1187 Token::Value Scanner::ScanNumber(bool seen_period) { |
1176 DCHECK(IsDecimalDigit(c0_)); // the first digit of the number or the fraction | 1188 DCHECK(IsDecimalDigit(c0_)); // the first digit of the number or the fraction |
1177 | 1189 |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1744 // 2, reset the source to the desired position, | 1756 // 2, reset the source to the desired position, |
1745 source_->Seek(position); | 1757 source_->Seek(position); |
1746 // 3, re-scan, by scanning the look-ahead char + 1 token (next_). | 1758 // 3, re-scan, by scanning the look-ahead char + 1 token (next_). |
1747 c0_ = source_->Advance(); | 1759 c0_ = source_->Advance(); |
1748 Next(); | 1760 Next(); |
1749 DCHECK_EQ(next_.location.beg_pos, static_cast<int>(position)); | 1761 DCHECK_EQ(next_.location.beg_pos, static_cast<int>(position)); |
1750 } | 1762 } |
1751 | 1763 |
1752 } // namespace internal | 1764 } // namespace internal |
1753 } // namespace v8 | 1765 } // namespace v8 |
OLD | NEW |