OLD | NEW |
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2010 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 #ifndef V8_UNICODE_INL_H_ | 5 #ifndef V8_UNICODE_INL_H_ |
6 #define V8_UNICODE_INL_H_ | 6 #define V8_UNICODE_INL_H_ |
7 | 7 |
8 #include "src/unicode.h" | 8 #include "src/unicode.h" |
9 #include "src/base/logging.h" | 9 #include "src/base/logging.h" |
10 #include "src/utils.h" | 10 #include "src/utils.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (Utf16::IsTrailSurrogate(c) && | 130 if (Utf16::IsTrailSurrogate(c) && |
131 Utf16::IsLeadSurrogate(previous)) { | 131 Utf16::IsLeadSurrogate(previous)) { |
132 return kSizeOfUnmatchedSurrogate - kBytesSavedByCombiningSurrogates; | 132 return kSizeOfUnmatchedSurrogate - kBytesSavedByCombiningSurrogates; |
133 } | 133 } |
134 return 3; | 134 return 3; |
135 } else { | 135 } else { |
136 return 4; | 136 return 4; |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
| 140 bool Utf8::IsValidCharacter(uchar c) { |
| 141 return c < 0xD800u || (c >= 0xE000u && c < 0xFDD0u) || |
| 142 (c > 0xFDEFu && c <= 0x10FFFFu && (c & 0xFFFEu) != 0xFFFEu && |
| 143 c != kBadChar); |
| 144 } |
| 145 |
140 } // namespace unibrow | 146 } // namespace unibrow |
141 | 147 |
142 #endif // V8_UNICODE_INL_H_ | 148 #endif // V8_UNICODE_INL_H_ |
OLD | NEW |