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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 | 155 |
156 class LiteralBuffer { | 156 class LiteralBuffer { |
157 public: | 157 public: |
158 LiteralBuffer() : is_one_byte_(true), position_(0), backing_store_() { } | 158 LiteralBuffer() : is_one_byte_(true), position_(0), backing_store_() { } |
159 | 159 |
160 ~LiteralBuffer() { backing_store_.Dispose(); } | 160 ~LiteralBuffer() { backing_store_.Dispose(); } |
161 | 161 |
162 INLINE(void AddChar(char code_unit)) { | 162 INLINE(void AddChar(char code_unit)) { |
163 if (position_ >= backing_store_.length()) ExpandBuffer(); | 163 if (position_ >= backing_store_.length()) ExpandBuffer(); |
164 DCHECK(is_one_byte_); | 164 DCHECK(is_one_byte_); |
165 DCHECK(0 <= code_unit && code_unit <= kMaxAscii); | 165 DCHECK(iscntrl(code_unit) || isprint(code_unit)); |
vogelheim
2016/07/11 07:42:49
Hrm. I searched for several minutes until I had fo
| |
166 backing_store_[position_] = static_cast<byte>(code_unit); | 166 backing_store_[position_] = static_cast<byte>(code_unit); |
167 position_ += kOneByteSize; | 167 position_ += kOneByteSize; |
168 return; | 168 return; |
169 } | 169 } |
170 | 170 |
171 INLINE(void AddChar(uc32 code_unit)) { | 171 INLINE(void AddChar(uc32 code_unit)) { |
172 if (position_ >= backing_store_.length()) ExpandBuffer(); | 172 if (position_ >= backing_store_.length()) ExpandBuffer(); |
173 if (is_one_byte_) { | 173 if (is_one_byte_) { |
174 if (code_unit <= unibrow::Latin1::kMaxChar) { | 174 if (code_unit <= unibrow::Latin1::kMaxChar) { |
175 backing_store_[position_] = static_cast<byte>(code_unit); | 175 backing_store_[position_] = static_cast<byte>(code_unit); |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
822 bool allow_harmony_exponentiation_operator_; | 822 bool allow_harmony_exponentiation_operator_; |
823 | 823 |
824 MessageTemplate::Template scanner_error_; | 824 MessageTemplate::Template scanner_error_; |
825 Location scanner_error_location_; | 825 Location scanner_error_location_; |
826 }; | 826 }; |
827 | 827 |
828 } // namespace internal | 828 } // namespace internal |
829 } // namespace v8 | 829 } // namespace v8 |
830 | 830 |
831 #endif // V8_PARSING_SCANNER_H_ | 831 #endif // V8_PARSING_SCANNER_H_ |
OLD | NEW |