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
10
11#include "unicode/uchar.h"
12#include "unicode/urename.h"
13
14namespace v8 {
15namespace internal {
16
17// ES#sec-names-and-keywords Names and Keywords
18// UnicodeIDStart, '$', '_' and '\'
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
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
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
uint32_t uc32
Definition strings.h:19
bool IsIdentifierPartSlow(base::uc32 c)
bool IsIdentifierStartSlow(base::uc32 c)
bool IsWhiteSpaceSlow(base::uc32 c)