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 10 matching lines...) Expand all Loading... |
21 namespace v8 { | 21 namespace v8 { |
22 namespace internal { | 22 namespace internal { |
23 | 23 |
24 | 24 |
25 class AstRawString; | 25 class AstRawString; |
26 class AstValueFactory; | 26 class AstValueFactory; |
27 class ParserRecorder; | 27 class ParserRecorder; |
28 class UnicodeCache; | 28 class UnicodeCache; |
29 | 29 |
30 | 30 |
31 // Returns the value (0 .. 15) of a hexadecimal character c. | |
32 // If c is not a legal hexadecimal character, returns a value < 0. | |
33 inline int HexValue(uc32 c) { | |
34 c -= '0'; | |
35 if (static_cast<unsigned>(c) <= 9) return c; | |
36 c = (c | 0x20) - ('a' - '0'); // detect 0x11..0x16 and 0x31..0x36. | |
37 if (static_cast<unsigned>(c) <= 5) return c + 10; | |
38 return -1; | |
39 } | |
40 | |
41 | |
42 // --------------------------------------------------------------------- | 31 // --------------------------------------------------------------------- |
43 // Buffered stream of UTF-16 code units, using an internal UTF-16 buffer. | 32 // Buffered stream of UTF-16 code units, using an internal UTF-16 buffer. |
44 // A code unit is a 16 bit value representing either a 16 bit code point | 33 // A code unit is a 16 bit value representing either a 16 bit code point |
45 // or one part of a surrogate pair that make a single 21 bit code point. | 34 // or one part of a surrogate pair that make a single 21 bit code point. |
46 | 35 |
47 class Utf16CharacterStream { | 36 class Utf16CharacterStream { |
48 public: | 37 public: |
49 Utf16CharacterStream() : pos_(0) { } | 38 Utf16CharacterStream() : pos_(0) { } |
50 virtual ~Utf16CharacterStream() { } | 39 virtual ~Utf16CharacterStream() { } |
51 | 40 |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 bool has_line_terminator_before_next_; | 751 bool has_line_terminator_before_next_; |
763 // Whether there is a multi-line comment that contains a | 752 // Whether there is a multi-line comment that contains a |
764 // line-terminator after the current token, and before the next. | 753 // line-terminator after the current token, and before the next. |
765 bool has_multiline_comment_before_next_; | 754 bool has_multiline_comment_before_next_; |
766 }; | 755 }; |
767 | 756 |
768 } // namespace internal | 757 } // namespace internal |
769 } // namespace v8 | 758 } // namespace v8 |
770 | 759 |
771 #endif // V8_PARSING_SCANNER_H_ | 760 #endif // V8_PARSING_SCANNER_H_ |
OLD | NEW |