tor-browser

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

line_normal_cj.txt (9558B)


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