tor-browser

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

line_loose.txt (9235B)


      1 #
      2 # Copyright (C) 2016 and later: Unicode, Inc. and others.
      3 # License & terms of use: http://www.unicode.org/copyright.html
      4 # Copyright (c) 2016, International Business Machines Corporation and others. All Rights Reserved.
      5 #
      6 #  file:  line_loose.txt
      7 #
      8 # Reference Line Break rules for intltest rbbi/RBBIMonkeyTest.
      9 # Rules derived from Unicode Standard Annex #14 for Unicode 16.0.
     10 #
     11 # Note: Rule syntax and the monkey test itself are still a work in progress.
     12 #       They are expected to change with review and the addition of support for rule tailoring.
     13 #
     14 #         This tailors the line break behavior to correspond to CSS
     15 #         line-break=loose (BCP47 -u-lb-loose) as defined for languages other than
     16 #         Chinese & Japanese.
     17 #         It sets characters of class CJ to behave like ID.
     18 #         In addition, it allows breaks:
     19 #         * before iteration marks 3005, 303B, 309D, 309E, 30FD, 30FE (all NS)
     20 #         * between characters of LineBreak class IN
     21 
     22 type = line;
     23 locale = en@lb=loose;
     24 
     25 
     26 AI = [:LineBreak =  Ambiguous:];
     27 AK = [:LineBreak =  Aksara:];
     28 AL = [:LineBreak =  Alphabetic:];
     29 AP = [:LineBreak =  Aksara_Prebase:];
     30 AS = [:LineBreak =  Aksara_Start:];
     31 BA = [:LineBreak =  Break_After:];
     32 HH = [:LineBreak =  Unambiguous_Hyphen:];
     33 BB = [:LineBreak =  Break_Before:];
     34 BK = [:LineBreak =  Mandatory_Break:];
     35 B2 = [:LineBreak =  Break_Both:];
     36 CB = [:LineBreak =  Contingent_Break:];
     37 CJ = [:LineBreak =  Conditional_Japanese_Starter:];
     38 CL = [:LineBreak =  Close_Punctuation:];
     39 CMS = [:LineBreak =  Combining_Mark:];
     40 CP = [:LineBreak =  Close_Parenthesis:];
     41 CR = [:LineBreak =  Carriage_Return:];
     42 EB = [:LineBreak =  EB:];
     43 EM = [:LineBreak =  EM:];
     44 EX = [:LineBreak =  Exclamation:];
     45 GL = [:LineBreak =  Glue:];
     46 HL = [:LineBreak =  Hebrew_Letter:];
     47 HY = [:LineBreak =  Hyphen:];
     48 H2 = [:LineBreak =  H2:];
     49 H3 = [:LineBreak =  H3:];
     50 ID = [[:LineBreak =  Ideographic:] CJ];  # CSS Normal tailoring: CJ resolves to ID
     51 IN = [:LineBreak =  Inseperable:];
     52 IS = [:LineBreak =  Infix_Numeric:];
     53 JL = [:LineBreak =  JL:];
     54 JV = [:LineBreak =  JV:];
     55 JT = [:LineBreak =  JT:];
     56 LF = [:LineBreak =  Line_Feed:];
     57 NL = [:LineBreak =  Next_Line:];
     58 NSX = [\u3005 \u303B \u309D \u309E \u30FD \u30FE];
     59 NS = [[:LineBreak =  Nonstarter:] - NSX];
     60 NU = [:LineBreak =  Numeric:];
     61 OP = [:LineBreak =  Open_Punctuation:];
     62 PO = [:LineBreak =  Postfix_Numeric:];
     63 PR = [:LineBreak =  Prefix_Numeric:];
     64 QU = [:LineBreak =  Quotation:];
     65 RI = [:LineBreak =  Regional_Indicator:];
     66 SA = [:LineBreak =  Complex_Context:];
     67 SG = [:LineBreak =  Surrogate:];
     68 SP = [:LineBreak =  Space:];
     69 SY = [:LineBreak =  Break_Symbols:];
     70 VF = [:LineBreak =  Virama_Final:];
     71 VI = [:LineBreak =  Virama:];
     72 WJ = [:LineBreak =  Word_Joiner:];
     73 XX = [:LineBreak =  Unknown:];
     74 ZW = [:LineBreak =  ZWSpace:];
     75 ZWJ = [:LineBreak =  ZWJ:];
     76 
     77 # OP30 and CP30 are variants of OP and CP that appear in rule LB30 from UAX 14.
     78 # Limitations of this monkey test rule parser require that these definitions be pulled out
     79 # rather than appearing in-line in LB 30.
     80 
     81 OP30 = [OP - [\p{ea=F}\p{ea=W}\p{ea=H}]];
     82 CP30 = [CP - [\p{ea=F}\p{ea=W}\p{ea=H}]];
     83 
     84 eaFWH            = [\p{ea=F}\p{ea=W}\p{ea=H}];
     85 eaFWHminusCMOPGL   = [ eaFWH - [CMS OP GL] ];
     86 eaFWHminusCM     = [ eaFWH - CMS ];
     87 eaFWHBreakableAtLB19 = [ eaFWH - [NS BA EX CL IN IS GL CMS] ];
     88 BAminuseaFWH = [BA - eaFWH ];
     89 
     90 PiQU = [\p{Pi}&QU];
     91 PfQU = [\p{Pf}&QU];
     92 
     93 # The redundant-looking inner brackets are required for the current parser in the test code.
     94 ExtPictUnassigned = [[\p{Extended_Pictographic}]&[\p{Cn}]];
     95 
     96 # LB1 - Resolve AI, CB, CJ, SA, SG, and XX into other line breaking classes
     97 AL = [AL AI SG XX ];
     98 dictionary = SA;
     99 
    100 # By LB9, a ZWJ also behaves as a CM. Including it in the definition of CM avoids having to explicitly
    101 #         list it in the numerous rules that use CM.
    102 CM = [CMS ZWJ];
    103 
    104 LB4:        BK ÷;
    105 LB5:        CR LF;
    106 LB5.1:      CR ÷;
    107 LB5.2:      LF ÷;
    108 LB5.3:      NL ÷;
    109 
    110 LB6:        . (BK | CR | LF | NL);
    111 LB6.1:      [^BK CR LF NL SP ZW] CM* (BK | CR | LF | NL);
    112 
    113 # LB8   break after ZW SP*.
    114 # Precedes LB7 because both rules will match the sequences like ZW SP,
    115 # and LB8 must take precedence.
    116 
    117 LB8:        ZW SP* ÷ [^ZW SP BK CR LF NL];
    118 
    119 # Numbers. Equivalent to Tailoring example 8 from UAX 14.
    120 # Moved up, before LB14, because it can match longer sequences which must take precedence.
    121 LB25:        ((PR | PO)CM*)? ((OP | HY)CM*)? (IS CM*)? NU (CM*(NU | SY | IS))* (CM*(CL | CP))? (CM*(PR | PO))?;
    122 
    123 # Rules LB14 - LB17.
    124 
    125 # Moved before LB14, because it matches a supersequence.
    126 LB20a.3: ( OP CM* SP* | QU CM* | GL CM* ) (PiQU CM* SP*)+ SP (HY | HH) CM* (AL | HL);
    127 LB15a.1:       ( OP CM* SP* | QU CM* | GL CM* ) (PiQU CM* SP*)+ .;
    128 
    129 # Moved before LB14.  These are really the cases where LB19a does not apply, but
    130 # the old LB19 would.  This is to avoid many instances of chaining over two code
    131 # points.
    132 LB19a.1: eaFWHminusCMOPGL         ÷ PiQU CM* eaFWHminusCM;
    133 LB19a.2: eaFWHminusCMOPGL CM* CMS ÷ PiQU CM* eaFWHminusCM;
    134 LB19a.5: eaFWHminusCM CM* PfQU         ÷ eaFWHBreakableAtLB19;
    135 LB19a.6: eaFWHminusCM CM* PfQU CM* CMS ÷ eaFWHBreakableAtLB19;
    136 
    137 # Moved up, before LB7, because they can match a longer sequence that would also match LB7.
    138 # For example, the sequence "OP CM SP AL" matches LB14
    139 # while the prefix of it, "OP CM SP" matches LB7.1
    140 LB20a.7:     OP CM* SP+ (HY | HH) CM* (AL | HL);
    141 LB14:        OP CM* SP* .;
    142 
    143 LB20a.4:       ^ (PiQU CM* SP*)+ SP (HY | HH) CM* (AL | HL);
    144 LB15a.2:       ^ (PiQU CM* SP*)+ .;
    145 # LB15b/LB15a chaining.
    146 LB20a.5:       ([^SP] CM* | SP) PfQU CM* (PiQU CM* SP*)+ SP (HY | HH) CM* (AL | HL);
    147 LB15b.1:       ([^SP] CM* | SP) PfQU CM* (PiQU CM* SP*)+ .;
    148 LB15b.2:       ([^SP] CM* | SP) PfQU CM* ( SP | GL | WJ | CL | QU | CP | EX | IS | SY | BK | CR | LF | NL | ZW | $ );
    149 
    150 # LB 15c Break before an IS that begins a number and follows a space.
    151 LB15c:       SP ÷ IS CM* NU;
    152 
    153 # LB15d       × IS
    154 LB15d.1:     [^SP] CM* IS;
    155 LB15d.2:     SP IS;
    156 
    157 LB16:        (CL | CP)CM* SP* NS;
    158 LB17:        B2 CM* SP* B2;
    159 
    160 
    161 # LB7 Do not break before spaces or zero width space.
    162 
    163 LB7.1:      [^ZW SP] CM* [SP ZW];
    164 LB7.2:      [ZW SP] [SP ZW];
    165 
    166 # LB8a
    167 #      ZWJ x
    168 #      Don't match a CM on the right - let other rules pick up CM sequences, where
    169 #      the ZWJ behaves as just another generic CM.
    170 LB8a:       ZWJ [^CM];
    171 
    172 
    173 # LB9:  X CM -> X
    174 # LB10: Unattached CM -> AL
    175 
    176 #LB11:       × WJ;
    177 #            WJ ×
    178 
    179 LB11.1:      [^SP] CM* WJ;
    180 LB11.2:      SP WJ;
    181 LB11.3:      WJ CM* [^CM];
    182 
    183 # Needs to apply before LB12, because the new monkeys are not greedy.
    184 LB20a.2:   GL CM* (HY | HH) CM* (AL | HL);
    185 LB12:      GL CM* [^CM];
    186 
    187 LB12a:       [^SP BA HY HH] CM* GL;
    188 
    189 # LB 13 Do not break before ‘]’ or ‘!’ or ‘/’, even after spaces.
    190 LB13.1: [^SP] CM* [CL CP EX SY];
    191 LB13.2: SP [CL CP EX SY];
    192 
    193 # LB 14-17 are moved above LB 7.
    194 
    195 LB18:        SP ÷;
    196 
    197 LB19:        . CM* QU;
    198 LB19.1:      QU CM* [^CM];
    199 
    200 # LB 20   Break before and after CB.
    201 #         Interaction with LB8a:  ZWJ x . is tricky because CM includes ZWJ.
    202 #                                 ZWJ acts like a CM to the left, combining with CB.
    203 #                                 ZWJ acts independently to the right, no break after by LB8a.
    204 LB20.1:      . CM* ZWJ CB;
    205 LB20.2:      . CM* ÷ CB;
    206 
    207 LB20a.6:     CB CM* ZWJ (HY | HH) CM* (AL | HL);
    208 LB20.3:      CB CM* ZWJ [^CM];
    209 LB20.4:      CB CM* ÷;
    210 
    211 # LB 20a    Do not break after a word-initial hyphen.
    212 LB20a.1:     ^(HY | HH) CM* (AL | HL);
    213 
    214 # Note: Rule 21a must come before 21 to prevent 21.1 from matching HL BA, then
    215 #       not picking up the continuing match after the BA from 21a.
    216 LB21a:       HL CM* (HY | HH) CM* [^CM CB HL];
    217 
    218 LB21.1:      . CM* [BA HY HH NS];
    219 LB21.2:      BB CM* [^CM CB];
    220 
    221 LB21b:       SY CM* HL;
    222 
    223 
    224 LB22:        [^IN] CM* IN;   # For CSS Loose, allow breaks between adjacent ellipses characters.
    225 
    226 LB23.1:      (AL | HL | CM) CM* NU;
    227 LB23.2:      NU CM* (AL | HL);
    228 
    229 LB23a.1:     PR CM* (ID | EB | EM);
    230 LB23a.2:     (ID | EB | EM) CM* PO;
    231 
    232 LB24.2:      (PR | PO) CM* (AL | HL);
    233 LB24.3:      (AL | HL | CM) CM* (PR | PO);
    234 
    235 
    236 LB26.1:      JL CM* (JL | JV | H2 | H3);
    237 LB26.2:      (JV | H2) CM* (JV | JT);
    238 LB26.3:      (JT | H3) CM* JT;
    239 
    240 LB27.1:      (JL | JV | JT | H2 | H3) CM* PO;
    241 LB27.2:      PR CM* (JL | JV | JT | H2 | H3);
    242 
    243 # LB28 Do not break between Alphabetics.
    244 #      Unattached (leading) CM treated as AL.
    245 LB28:        (AL | HL | CM)CM* (AL | HL);
    246 
    247 LB28: (AP CM*)? (AS | AK | [◌] ) (CM* VI CM* (AK | [◌] ))* (CM* VI | ((CM* (AS | AK | [◌] ) )? CM* VF))?;
    248 
    249 LB29:        IS CM* (AL | HL);
    250 
    251 # LB30  is adjusted for unattached leading CM being treated as AL.
    252 LB30.1:      (AL | CM | HL | NU) CM* OP30;
    253 LB30.2:      CP30 CM* (AL | HL | NU);
    254 
    255 # LB30a  keep pairs of RI together.
    256 LB30a.1:     RI CM* RI         ÷ [^BK CR LF NL SP ZW WJ CL CP EX IS SY GL QU BA HH HY NS IN CM];
    257 LB30a.2:     RI CM* RI CM* CMS ÷ [^BK CR LF NL SP ZW WJ CL CP EX IS SY GL QU BA HH HY NS IN CM];
    258 LB30a.3:     RI CM* RI CM* [BK CR LF NL SP ZW WJ GL CL CP EX IS SY QU BA HH HY NS IN ZWJ]?;
    259 
    260 # LB30b Do not break between Emoji Base (or potential emoji) and Emoji Modifier
    261 LB30b.1:       EB CM* EM;
    262 LB30b.2:       ExtPictUnassigned CM* EM;
    263 
    264 # LB31 Break Everywhere Else.
    265 #      Include combining marks
    266 LB31.1:        . CM* ZWJ [^CM];
    267 LB31.2:        . CM* ÷;