1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_UNICODE_CACHE_INL_H_
6 #define V8_UNICODE_CACHE_INL_H_
7 
8 #include "src/unicode-inl.h"
9 #include "src/unicode-cache.h"
10 
11 namespace v8 {
12 namespace internal {
13 
IsIdentifierStart(unibrow::uchar c)14 bool UnicodeCache::IsIdentifierStart(unibrow::uchar c) {
15   return kIsIdentifierStart.get(c);
16 }
17 
18 
IsIdentifierPart(unibrow::uchar c)19 bool UnicodeCache::IsIdentifierPart(unibrow::uchar c) {
20   return kIsIdentifierPart.get(c);
21 }
22 
23 
IsLineTerminator(unibrow::uchar c)24 bool UnicodeCache::IsLineTerminator(unibrow::uchar c) {
25   return kIsLineTerminator.get(c);
26 }
27 
28 
IsLineTerminatorSequence(unibrow::uchar c,unibrow::uchar next)29 bool UnicodeCache::IsLineTerminatorSequence(unibrow::uchar c,
30                                             unibrow::uchar next) {
31   if (!IsLineTerminator(c)) return false;
32   if (c == 0x000d && next == 0x000a) return false;  // CR with following LF.
33   return true;
34 }
35 
36 
IsWhiteSpace(unibrow::uchar c)37 bool UnicodeCache::IsWhiteSpace(unibrow::uchar c) {
38   return kIsWhiteSpace.get(c);
39 }
40 
41 
IsWhiteSpaceOrLineTerminator(unibrow::uchar c)42 bool UnicodeCache::IsWhiteSpaceOrLineTerminator(unibrow::uchar c) {
43   return kIsWhiteSpaceOrLineTerminator.get(c);
44 }
45 
46 }  // namespace internal
47 }  // namespace v8
48 
49 #endif  // V8_UNICODE_CACHE_INL_H_
50