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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 // [current_] [next_] c0_ | [scanner state] | 835 // [current_] [next_] c0_ | [scanner state] |
836 // So when the scanner is logically at the beginning of an expression | 836 // So when the scanner is logically at the beginning of an expression |
837 // like "1234 + 4567", then: | 837 // like "1234 + 4567", then: |
838 // - current_ contains "1234" | 838 // - current_ contains "1234" |
839 // - next_ contains "+" | 839 // - next_ contains "+" |
840 // - c0_ contains ' ' (the space between "+" and "5678", | 840 // - c0_ contains ' ' (the space between "+" and "5678", |
841 // - the source_ character stream points to the beginning of "5678". | 841 // - the source_ character stream points to the beginning of "5678". |
842 // To be able to restore this state, we will keep copies of current_, next_, | 842 // To be able to restore this state, we will keep copies of current_, next_, |
843 // and c0_; we'll ask the stream to bookmark itself, and we'll copy the | 843 // and c0_; we'll ask the stream to bookmark itself, and we'll copy the |
844 // contents of current_'s and next_'s literal buffers to bookmark_*_literal_. | 844 // contents of current_'s and next_'s literal buffers to bookmark_*_literal_. |
845 static const uc32 kNoBookmark = -1; | 845 static const uc32 kNoBookmark = -2; |
846 static const uc32 kBookmarkWasApplied = -2; | 846 static const uc32 kBookmarkWasApplied = -3; |
847 uc32 bookmark_c0_; | 847 uc32 bookmark_c0_; |
848 TokenDesc bookmark_current_; | 848 TokenDesc bookmark_current_; |
849 TokenDesc bookmark_next_; | 849 TokenDesc bookmark_next_; |
850 LiteralBuffer bookmark_current_literal_; | 850 LiteralBuffer bookmark_current_literal_; |
851 LiteralBuffer bookmark_current_raw_literal_; | 851 LiteralBuffer bookmark_current_raw_literal_; |
852 LiteralBuffer bookmark_next_literal_; | 852 LiteralBuffer bookmark_next_literal_; |
853 LiteralBuffer bookmark_next_raw_literal_; | 853 LiteralBuffer bookmark_next_raw_literal_; |
854 | 854 |
855 // Input stream. Must be initialized to an Utf16CharacterStream. | 855 // Input stream. Must be initialized to an Utf16CharacterStream. |
856 Utf16CharacterStream* source_; | 856 Utf16CharacterStream* source_; |
(...skipping 18 matching lines...) Expand all Loading... |
875 bool found_html_comment_; | 875 bool found_html_comment_; |
876 | 876 |
877 MessageTemplate::Template scanner_error_; | 877 MessageTemplate::Template scanner_error_; |
878 Location scanner_error_location_; | 878 Location scanner_error_location_; |
879 }; | 879 }; |
880 | 880 |
881 } // namespace internal | 881 } // namespace internal |
882 } // namespace v8 | 882 } // namespace v8 |
883 | 883 |
884 #endif // V8_PARSING_SCANNER_H_ | 884 #endif // V8_PARSING_SCANNER_H_ |
OLD | NEW |