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 } | |
350 | 346 |
351 Handle<String> SourceUrl(Isolate* isolate) const; | 347 Handle<String> SourceUrl(Isolate* isolate) const; |
352 Handle<String> SourceMappingUrl(Isolate* isolate) const; | 348 Handle<String> SourceMappingUrl(Isolate* isolate) const; |
353 | 349 |
354 bool FoundHtmlComment() const { return found_html_comment_; } | 350 bool FoundHtmlComment() const { return found_html_comment_; } |
355 | 351 |
356 private: | 352 private: |
357 // Scoped helper for saving & restoring scanner error state. | 353 // Scoped helper for saving & restoring scanner error state. |
358 // This is used for tagged template literals, in which normally forbidden | 354 // This is used for tagged template literals, in which normally forbidden |
359 // escape sequences are allowed. | 355 // escape sequences are allowed. |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 bool found_html_comment_; | 793 bool found_html_comment_; |
798 | 794 |
799 MessageTemplate::Template scanner_error_; | 795 MessageTemplate::Template scanner_error_; |
800 Location scanner_error_location_; | 796 Location scanner_error_location_; |
801 }; | 797 }; |
802 | 798 |
803 } // namespace internal | 799 } // namespace internal |
804 } // namespace v8 | 800 } // namespace v8 |
805 | 801 |
806 #endif // V8_PARSING_SCANNER_H_ | 802 #endif // V8_PARSING_SCANNER_H_ |
OLD | NEW |