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 #ifndef V8_PARSING_SCANNER_H_ | 7 #ifndef V8_PARSING_SCANNER_H_ |
8 #define V8_PARSING_SCANNER_H_ | 8 #define V8_PARSING_SCANNER_H_ |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 } | 335 } |
336 | 336 |
337 // Scans the input as a regular expression pattern, next token must be /(=). | 337 // Scans the input as a regular expression pattern, next token must be /(=). |
338 // Returns true if a pattern is scanned. | 338 // Returns true if a pattern is scanned. |
339 bool ScanRegExpPattern(); | 339 bool ScanRegExpPattern(); |
340 // Scans the input as regular expression flags. Returns the flags on success. | 340 // Scans the input as regular expression flags. Returns the flags on success. |
341 Maybe<RegExp::Flags> ScanRegExpFlags(); | 341 Maybe<RegExp::Flags> ScanRegExpFlags(); |
342 | 342 |
343 // Scans the input as a template literal | 343 // Scans the input as a template literal |
344 Token::Value ScanTemplateStart(); | 344 Token::Value ScanTemplateStart(); |
345 Token::Value ScanTemplateContinuation(); | 345 Token::Value ScanTemplateContinuation() { |
| 346 DCHECK_EQ(next_.token, Token::RBRACE); |
| 347 next_.location.beg_pos = source_pos() - 1; // We already consumed } |
| 348 return ScanTemplateSpan(); |
| 349 } |
346 | 350 |
347 Handle<String> SourceUrl(Isolate* isolate) const; | 351 Handle<String> SourceUrl(Isolate* isolate) const; |
348 Handle<String> SourceMappingUrl(Isolate* isolate) const; | 352 Handle<String> SourceMappingUrl(Isolate* isolate) const; |
349 | 353 |
350 bool FoundHtmlComment() const { return found_html_comment_; } | 354 bool FoundHtmlComment() const { return found_html_comment_; } |
351 | 355 |
352 private: | 356 private: |
353 // Scoped helper for saving & restoring scanner error state. | 357 // Scoped helper for saving & restoring scanner error state. |
354 // This is used for tagged template literals, in which normally forbidden | 358 // This is used for tagged template literals, in which normally forbidden |
355 // escape sequences are allowed. | 359 // escape sequences are allowed. |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 bool found_html_comment_; | 797 bool found_html_comment_; |
794 | 798 |
795 MessageTemplate::Template scanner_error_; | 799 MessageTemplate::Template scanner_error_; |
796 Location scanner_error_location_; | 800 Location scanner_error_location_; |
797 }; | 801 }; |
798 | 802 |
799 } // namespace internal | 803 } // namespace internal |
800 } // namespace v8 | 804 } // namespace v8 |
801 | 805 |
802 #endif // V8_PARSING_SCANNER_H_ | 806 #endif // V8_PARSING_SCANNER_H_ |
OLD | NEW |