4aeb94a42d
Use ICU to check ID_Start, ID_Continue and WhiteSpace even for BMP when V8_INTL_SUPPORT is on (which is default). Change LineTerminator::Is() to check 4 code points from ES#sec-line-terminators instead of using tables and Lookup function. Remove Lowercase::Is(). It's not used anywhere. Update webkit/{ToNumber,parseFloat}.js to have the correct expectation for U+180E and the corresponding expected files. This is a follow-up to an earlier change ( https://codereview.chromium.org/2720953003 ). CQ_INCLUDE_TRYBOTS=master.tryserver.v8:v8_win_dbg,v8_mac_dbg;master.tryserver.chromium.android:android_arm64_dbg_recipe CQ_INCLUDE_TRYBOTS=master.tryserver.v8:v8_linux_noi18n_rel_ng BUG=v8:5370,v8:5155 TEST=unittests --gtest_filter=CharP* TEST=webkit: ToNumber, parseFloat TEST=test262: built-ins/Number/S9.3*, built-ins/parse{Int,Float}/S15* TEST=test262: language/white-space/mong* TEST=test262: built-ins/String/prototype/trim/u180e TEST=mjsunit: whitespaces Review-Url: https://codereview.chromium.org/2331303002 Cr-Commit-Position: refs/heads/master@{#45957}
45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
// Copyright 2011 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef V8_INTL_SUPPORT
|
|
#error Internationalization is expected to be enabled.
|
|
#endif // V8_INTL_SUPPORT
|
|
|
|
#include "src/char-predicates.h"
|
|
|
|
#include "unicode/uchar.h"
|
|
#include "unicode/urename.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
// ES#sec-names-and-keywords Names and Keywords
|
|
// UnicodeIDStart, '$', '_' and '\'
|
|
bool IdentifierStart::Is(uc32 c) {
|
|
// cannot use u_isIDStart because it does not work for
|
|
// Other_ID_Start characters.
|
|
return u_hasBinaryProperty(c, UCHAR_ID_START) ||
|
|
(c < 0x60 && (c == '$' || c == '\\' || c == '_'));
|
|
}
|
|
|
|
// ES#sec-names-and-keywords Names and Keywords
|
|
// UnicodeIDContinue, '$', '_', '\', ZWJ, and ZWNJ
|
|
bool IdentifierPart::Is(uc32 c) {
|
|
// Can't use u_isIDPart because it does not work for
|
|
// Other_ID_Continue characters.
|
|
return u_hasBinaryProperty(c, UCHAR_ID_CONTINUE) ||
|
|
(c < 0x60 && (c == '$' || c == '\\' || c == '_')) || c == 0x200C ||
|
|
c == 0x200D;
|
|
}
|
|
|
|
// ES#sec-white-space White Space
|
|
// gC=Zs, U+0009, U+000B, U+000C, U+FEFF
|
|
bool WhiteSpace::Is(uc32 c) {
|
|
return (u_charType(c) == U_SPACE_SEPARATOR) ||
|
|
(c < 0x0D && (c == 0x09 || c == 0x0B || c == 0x0C)) || c == 0xFEFF;
|
|
}
|
|
|
|
} // namespace internal
|
|
} // namespace v8
|