OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/regexp/regexp-parser.h" | 5 #include "src/regexp/regexp-parser.h" |
6 | 6 |
7 #include "src/char-predicates-inl.h" | 7 #include "src/char-predicates-inl.h" |
8 #include "src/factory.h" | 8 #include "src/factory.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 if (to >= kNonBmpStart) return true; | 1287 if (to >= kNonBmpStart) return true; |
1288 // Check for lone surrogates. | 1288 // Check for lone surrogates. |
1289 if (from <= kTrailSurrogateEnd && to >= kLeadSurrogateStart) return true; | 1289 if (from <= kTrailSurrogateEnd && to >= kLeadSurrogateStart) return true; |
1290 } | 1290 } |
1291 return false; | 1291 return false; |
1292 } | 1292 } |
1293 | 1293 |
1294 | 1294 |
1295 bool RegExpBuilder::NeedsDesugaringForIgnoreCase(uc32 c) { | 1295 bool RegExpBuilder::NeedsDesugaringForIgnoreCase(uc32 c) { |
1296 #ifdef V8_I18N_SUPPORT | 1296 #ifdef V8_I18N_SUPPORT |
1297 if (unicode() && ignore_case() && c >= kNonBmpStart) { | 1297 if (unicode() && ignore_case()) { |
1298 // BMP characters are handled in the case-insensitive TextEmitPass. | |
1299 // Surrogate code units do not have case equivalents. | |
1300 // Non-BMP characters need to be desugared into two uc16 parts. | |
1301 USet* set = uset_open(c, c); | 1298 USet* set = uset_open(c, c); |
1302 uset_closeOver(set, USET_CASE_INSENSITIVE); | 1299 uset_closeOver(set, USET_CASE_INSENSITIVE); |
1303 uset_removeAllStrings(set); | 1300 uset_removeAllStrings(set); |
1304 bool result = uset_size(set) > 1; | 1301 bool result = uset_size(set) > 1; |
1305 uset_close(set); | 1302 uset_close(set); |
1306 return result; | 1303 return result; |
1307 } | 1304 } |
1308 // In the case where ICU is not included, we act as if the unicode flag is | 1305 // In the case where ICU is not included, we act as if the unicode flag is |
1309 // not set, and do not desugar. | 1306 // not set, and do not desugar. |
1310 #endif // V8_I18N_SUPPORT | 1307 #endif // V8_I18N_SUPPORT |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 return false; | 1362 return false; |
1366 } | 1363 } |
1367 terms_.Add(new (zone()) RegExpQuantifier(min, max, quantifier_type, atom), | 1364 terms_.Add(new (zone()) RegExpQuantifier(min, max, quantifier_type, atom), |
1368 zone()); | 1365 zone()); |
1369 LAST(ADD_TERM); | 1366 LAST(ADD_TERM); |
1370 return true; | 1367 return true; |
1371 } | 1368 } |
1372 | 1369 |
1373 } // namespace internal | 1370 } // namespace internal |
1374 } // namespace v8 | 1371 } // namespace v8 |
OLD | NEW |