Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Unified Diff: src/char-predicates.h

Issue 2331303002: Use ICU for ID_START and ID_CONTINUE for Unicode 9 data (Closed)
Patch Set: drop an unnecessary todo Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « BUILD.gn ('k') | src/char-predicates.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/char-predicates.h
diff --git a/src/char-predicates.h b/src/char-predicates.h
index 966b2a59369adcccf3a1de5466ad7e431617b7fa..88208d04f6730e96436b60377abb3415ed087c78 100644
--- a/src/char-predicates.h
+++ b/src/char-predicates.h
@@ -26,53 +26,58 @@ inline bool IsBinaryDigit(uc32 c);
inline bool IsRegExpWord(uc32 c);
inline bool IsRegExpNewline(uc32 c);
-struct V8_EXPORT_PRIVATE SupplementaryPlanes {
- static bool IsIDStart(uc32 c);
- static bool IsIDPart(uc32 c);
-};
-
-
-// ES6 draft section 11.6
+// ES#sec-names-and-keywords
// This includes '_', '$' and '\', and ID_Start according to
// http://www.unicode.org/reports/tr31/, which consists of categories
// 'Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl', but excluding properties
// 'Pattern_Syntax' or 'Pattern_White_Space'.
-// For code points in the SMPs, we can resort to ICU (if available).
+#ifdef V8_INTL_SUPPORT
+struct V8_EXPORT_PRIVATE IdentifierStart {
+ static bool Is(uc32 c);
+#else
struct IdentifierStart {
+ // Non-BMP characters are not supported without I18N.
static inline bool Is(uc32 c) {
- if (c > 0xFFFF) return SupplementaryPlanes::IsIDStart(c);
- return unibrow::ID_Start::Is(c);
+ return (c <= 0xFFFF) ? unibrow::ID_Start::Is(c) : false;
}
+#endif
};
-
-// ES6 draft section 11.6
+// ES#sec-names-and-keywords
// This includes \u200c and \u200d, and ID_Continue according to
// http://www.unicode.org/reports/tr31/, which consists of ID_Start,
// the categories 'Mn', 'Mc', 'Nd', 'Pc', but excluding properties
// 'Pattern_Syntax' or 'Pattern_White_Space'.
-// For code points in the SMPs, we can resort to ICU (if available).
+#ifdef V8_INTL_SUPPORT
+struct V8_EXPORT_PRIVATE IdentifierPart {
+ static bool Is(uc32 c);
+#else
struct IdentifierPart {
static inline bool Is(uc32 c) {
- if (c > 0xFFFF) return SupplementaryPlanes::IsIDPart(c);
- return unibrow::ID_Start::Is(c) || unibrow::ID_Continue::Is(c);
+ // Non-BMP charaacters are not supported without I18N.
+ if (c <= 0xFFFF) {
+ return unibrow::ID_Start::Is(c) || unibrow::ID_Continue::Is(c);
+ }
+ return false;
}
+#endif
};
-
// ES6 draft section 11.2
// This includes all code points of Unicode category 'Zs'.
-// \u180e stops being one as of Unicode 6.3.0, but ES6 adheres to Unicode 5.1,
-// so it is also included.
-// Further included are \u0009, \u000b, \u0020, \u00a0, \u000c, and \ufeff.
-// There are no category 'Zs' code points in the SMPs.
+// Further included are \u0009, \u000b, \u000c, and \ufeff.
+#ifdef V8_INTL_SUPPORT
+struct V8_EXPORT_PRIVATE WhiteSpace {
+ static bool Is(uc32 c);
+#else
struct WhiteSpace {
static inline bool Is(uc32 c) { return unibrow::WhiteSpace::Is(c); }
+#endif
};
-
// WhiteSpace and LineTerminator according to ES6 draft section 11.2 and 11.3
-// This consists of \000a, \000d, \u2028, and \u2029.
+// This includes all the characters with Unicode category 'Z' (= Zs+Zl+Zp)
+// as well as \u0009 - \u000d and \ufeff.
struct WhiteSpaceOrLineTerminator {
static inline bool Is(uc32 c) {
return WhiteSpace::Is(c) || unibrow::LineTerminator::Is(c);
« no previous file with comments | « BUILD.gn ('k') | src/char-predicates.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698