tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

special-case.cc (2051B)


      1 // Copyright 2020 the V8 project authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that
      3 // can be found in the LICENSE file.
      4 
      5 // Automatically generated by regexp/gen-regexp-special-case.cc
      6 
      7 // The following functions are used to build UnicodeSets
      8 // for special cases where the case-folding algorithm used by
      9 // UnicodeSet::closeOver(USET_CASE_INSENSITIVE) does not match
     10 // the algorithm defined in ECMAScript 2020 21.2.2.8.2 (Runtime
     11 // Semantics: Canonicalize) step 3.
     12 
     13 #ifdef V8_INTL_SUPPORT
     14 #include "irregexp/imported/special-case.h"
     15 
     16 #include "unicode/uniset.h"
     17 namespace v8 {
     18 namespace internal {
     19 
     20 icu::UnicodeSet BuildIgnoreSet() {
     21  icu::UnicodeSet set;
     22  set.add(0xdf);
     23  set.add(0x17f);
     24  set.add(0x390);
     25  set.add(0x3b0);
     26  set.add(0x3f4);
     27  set.add(0x1e9e);
     28  set.add(0x1f80, 0x1faf);
     29  set.add(0x1fb3);
     30  set.add(0x1fbc);
     31  set.add(0x1fc3);
     32  set.add(0x1fcc);
     33  set.add(0x1fd3);
     34  set.add(0x1fe3);
     35  set.add(0x1ff3);
     36  set.add(0x1ffc);
     37  set.add(0x2126);
     38  set.add(0x212a, 0x212b);
     39  set.add(0xfb05, 0xfb06);
     40  set.freeze();
     41  return set;
     42 }
     43 
     44 struct IgnoreSetData {
     45  IgnoreSetData() : set(BuildIgnoreSet()) {}
     46  const icu::UnicodeSet set;
     47 };
     48 
     49 //static
     50 const icu::UnicodeSet& RegExpCaseFolding::IgnoreSet() {
     51  static base::LazyInstance<IgnoreSetData>::type set =
     52      LAZY_INSTANCE_INITIALIZER;
     53  return set.Pointer()->set;
     54 }
     55 
     56 icu::UnicodeSet BuildSpecialAddSet() {
     57  icu::UnicodeSet set;
     58  set.add(0x4b);
     59  set.add(0x53);
     60  set.add(0x6b);
     61  set.add(0x73);
     62  set.add(0xc5);
     63  set.add(0xe5);
     64  set.add(0x398);
     65  set.add(0x3a9);
     66  set.add(0x3b8);
     67  set.add(0x3c9);
     68  set.add(0x3d1);
     69  set.freeze();
     70  return set;
     71 }
     72 
     73 struct SpecialAddSetData {
     74  SpecialAddSetData() : set(BuildSpecialAddSet()) {}
     75  const icu::UnicodeSet set;
     76 };
     77 
     78 //static
     79 const icu::UnicodeSet& RegExpCaseFolding::SpecialAddSet() {
     80  static base::LazyInstance<SpecialAddSetData>::type set =
     81      LAZY_INSTANCE_INITIALIZER;
     82  return set.Pointer()->set;
     83 }
     84 
     85 
     86 }  // namespace internal
     87 }  // namespace v8
     88 #endif  // V8_INTL_SUPPORT