| 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_SCANNER_H_ | 7 #ifndef V8_SCANNER_H_ |
| 8 #define V8_SCANNER_H_ | 8 #define V8_SCANNER_H_ |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 212 } |
| 213 ConvertToTwoByte(); | 213 ConvertToTwoByte(); |
| 214 } | 214 } |
| 215 if (code_unit <= unibrow::Utf16::kMaxNonSurrogateCharCode) { | 215 if (code_unit <= unibrow::Utf16::kMaxNonSurrogateCharCode) { |
| 216 *reinterpret_cast<uint16_t*>(&backing_store_[position_]) = code_unit; | 216 *reinterpret_cast<uint16_t*>(&backing_store_[position_]) = code_unit; |
| 217 position_ += kUC16Size; | 217 position_ += kUC16Size; |
| 218 } else { | 218 } else { |
| 219 *reinterpret_cast<uint16_t*>(&backing_store_[position_]) = | 219 *reinterpret_cast<uint16_t*>(&backing_store_[position_]) = |
| 220 unibrow::Utf16::LeadSurrogate(code_unit); | 220 unibrow::Utf16::LeadSurrogate(code_unit); |
| 221 position_ += kUC16Size; | 221 position_ += kUC16Size; |
| 222 if (position_ >= backing_store_.length()) ExpandBuffer(); |
| 222 *reinterpret_cast<uint16_t*>(&backing_store_[position_]) = | 223 *reinterpret_cast<uint16_t*>(&backing_store_[position_]) = |
| 223 unibrow::Utf16::TrailSurrogate(code_unit); | 224 unibrow::Utf16::TrailSurrogate(code_unit); |
| 224 position_ += kUC16Size; | 225 position_ += kUC16Size; |
| 225 } | 226 } |
| 226 } | 227 } |
| 227 | 228 |
| 228 bool is_one_byte() const { return is_one_byte_; } | 229 bool is_one_byte() const { return is_one_byte_; } |
| 229 | 230 |
| 230 bool is_contextual_keyword(Vector<const char> keyword) const { | 231 bool is_contextual_keyword(Vector<const char> keyword) const { |
| 231 return is_one_byte() && keyword.length() == position_ && | 232 return is_one_byte() && keyword.length() == position_ && |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 bool harmony_modules_; | 679 bool harmony_modules_; |
| 679 // Whether we scan 0o777 and 0b111 as numbers. | 680 // Whether we scan 0o777 and 0b111 as numbers. |
| 680 bool harmony_numeric_literals_; | 681 bool harmony_numeric_literals_; |
| 681 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. | 682 // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. |
| 682 bool harmony_classes_; | 683 bool harmony_classes_; |
| 683 }; | 684 }; |
| 684 | 685 |
| 685 } } // namespace v8::internal | 686 } } // namespace v8::internal |
| 686 | 687 |
| 687 #endif // V8_SCANNER_H_ | 688 #endif // V8_SCANNER_H_ |
| OLD | NEW |