v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
char-predicates.cc
Go to the documentation of this file.
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
3
// found in the LICENSE file.
4
5
#ifndef V8_INTL_SUPPORT
6
#error Internationalization is expected to be enabled.
7
#endif
// V8_INTL_SUPPORT
8
9
#include "
src/strings/char-predicates.h
"
10
11
#include "unicode/uchar.h"
12
#include "unicode/urename.h"
13
14
namespace
v8
{
15
namespace
internal
{
16
17
// ES#sec-names-and-keywords Names and Keywords
18
// UnicodeIDStart, '$', '_' and '\'
19
bool
IsIdentifierStartSlow
(
base::uc32
c) {
20
// cannot use u_isIDStart because it does not work for
21
// Other_ID_Start characters.
22
return
u_hasBinaryProperty(c, UCHAR_ID_START) ||
23
(c < 0x60 && (c ==
'$'
|| c ==
'\\'
|| c ==
'_'
));
24
}
25
26
// ES#sec-names-and-keywords Names and Keywords
27
// UnicodeIDContinue, '$', '_', '\', ZWJ, and ZWNJ
28
bool
IsIdentifierPartSlow
(
base::uc32
c) {
29
// Can't use u_isIDPart because it does not work for
30
// Other_ID_Continue characters.
31
return
u_hasBinaryProperty(c, UCHAR_ID_CONTINUE) ||
32
(c < 0x60 && (c ==
'$'
|| c ==
'\\'
|| c ==
'_'
)) || c == 0x200C ||
33
c == 0x200D;
34
}
35
36
// ES#sec-white-space White Space
37
// gC=Zs, U+0009, U+000B, U+000C, U+FEFF
38
bool
IsWhiteSpaceSlow
(
base::uc32
c) {
39
return
(u_charType(c) == U_SPACE_SEPARATOR) ||
40
(c < 0x0D && (c == 0x09 || c == 0x0B || c == 0x0C)) || c == 0xFEFF;
41
}
42
43
}
// namespace internal
44
}
// namespace v8
char-predicates.h
v8::base::uc32
uint32_t uc32
Definition
strings.h:19
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8::internal::IsIdentifierPartSlow
bool IsIdentifierPartSlow(base::uc32 c)
Definition
char-predicates.cc:28
v8::internal::IsIdentifierStartSlow
bool IsIdentifierStartSlow(base::uc32 c)
Definition
char-predicates.cc:19
v8::internal::IsWhiteSpaceSlow
bool IsWhiteSpaceSlow(base::uc32 c)
Definition
char-predicates.cc:38
v8
Definition
api-arguments-inl.h:19
src
strings
char-predicates.cc
Generated on Sun Apr 6 2025 21:08:57 for v8 by
1.12.0