Chromium Code Reviews| Index: src/char-predicates.h |
| diff --git a/src/char-predicates.h b/src/char-predicates.h |
| index 966b2a59369adcccf3a1de5466ad7e431617b7fa..5634e8c566c364137de953f1c8cffde79e465776 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 |
| // 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 charaacters are not supported without I18N. |
|
mathias
2017/05/08 20:43:06
typo: characters
|
| 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 |
| // 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); |