2 # Copyright (c) 2016, International Business Machines Corporation and others. All Rights Reserved.
6 # Reference Line Break rules for intltest rbbi/RBBIMonkeyTest
8 # Note: Rule syntax and the monkey test itself are still a work in progress.
9 # They are expected to change with review and the addition of support for rule tailoring.
11 # This tailors the line break behavior to correspond to CSS
12 # line-break=loose (BCP47 -u-lb-loose) as defined for languages other than
14 # It sets characters of class CJ to behave like ID.
15 # In addition, it allows breaks:
16 # * before iteration marks 3005, 303B, 309D, 309E, 30FD, 30FE (all NS)
17 # * between characters of LineBreak class IN
23 AI = [[:LineBreak = Ambiguous:] - [\u2640\u2642]];
24 AL = [[:LineBreak = Alphabetic:]-[\u2764]];
25 BA = [:LineBreak = Break_After:];
26 BB = [:LineBreak = Break_Before:];
27 BK = [:LineBreak = Mandatory_Break:];
28 B2 = [:LineBreak = Break_Both:];
29 CB = [:LineBreak = Contingent_Break:];
30 CJ = [:LineBreak = Conditional_Japanese_Starter:];
31 CL = [:LineBreak = Close_Punctuation:];
32 CM = [[:LineBreak = Combining_Mark:] \u200D];
33 CP = [:LineBreak = Close_Parenthesis:];
34 CR = [:LineBreak = Carriage_Return:];
36 EB = [\u261D\u26F9\u270A-\u270D\U0001F385\U0001F3C3-\U0001F3C4\U0001F3CA-\U0001F3CB\U0001F442-\U0001F443\U0001F446-\U0001F450\U0001F466-\U0001F469\U0001F46E\U0001F470-\U0001F478\U0001F47C\U0001F481-\U0001F483\U0001F485-\U0001F487\U0001F4AA\U0001F575\U0001F590\U0001F595-\U0001F596\U0001F645-\U0001F647\U0001F64B-\U0001F64F\U0001F6A3\U0001F6B4-\U0001F6B6\U0001F6C0\U0001F918];
37 EM = [\U0001F3FB-\U0001F3FF];
39 EX = [:LineBreak = Exclamation:];
40 GL = [:LineBreak = Glue:];
41 HL = [:LineBreak = Hebrew_Letter:];
42 HY = [:LineBreak = Hyphen:];
43 H2 = [:LineBreak = H2:];
44 H3 = [:LineBreak = H3:];
45 ID = [[:LineBreak = Ideographic:] CJ [\u2640\u2642\u2764]];
46 IN = [:LineBreak = Inseperable:];
47 IS = [:LineBreak = Infix_Numeric:];
48 JL = [:LineBreak = JL:];
49 JV = [:LineBreak = JV:];
50 JT = [:LineBreak = JT:];
51 LF = [:LineBreak = Line_Feed:];
52 NL = [:LineBreak = Next_Line:];
53 NSX = [\u3005 \u303B \u309D \u309E \u30FD \u30FE];
54 NS = [[:LineBreak = Nonstarter:] - NSX];
55 NU = [:LineBreak = Numeric:];
56 OP = [:LineBreak = Open_Punctuation:];
57 PO = [:LineBreak = Postfix_Numeric:];
58 PR = [:LineBreak = Prefix_Numeric:];
59 QU = [:LineBreak = Quotation:];
60 RI = [:LineBreak = Regional_Indicator:];
61 SA = [:LineBreak = Complex_Context:];
62 SG = [:LineBreak = Surrogate:];
63 SP = [:LineBreak = Space:];
64 SY = [:LineBreak = Break_Symbols:];
65 WJ = [:LineBreak = Word_Joiner:];
66 XX = [:LineBreak = Unknown:];
67 ZW = [:LineBreak = ZWSpace:];
70 # TODO: adjustment to sets needed only until Unicode properties are updated for Emoji.
74 dictionary = [:LineBreak = Complex_Context:];
76 # Redfine AL. LB1. TODO: refine according to latest UAX.
77 AL = [ AL AI SA SG XX ];
85 LB6: . (BK | CR | LF | NL);
86 LB6.1: [^BK CR LF NL SP ZW] CM* (BK | CR | LF | NL);
89 # Moved before LB7, because they can match a longer sequence that would also match LB7,
90 # for example, the sequence "OP CM SP AL" matches LB14 while the prefix of it,
91 # "while only the prefix "OP CM SP" matches LB7.1
94 LB16: (CL | CP)CM* SP* NS;
97 LB7.1: [^ZW SP] CM* [SP ZW];
98 LB7.2: [ZW SP] [SP ZW];
100 # LB8, ICU differs from UAX-14,
105 # LB8a, from Emoji proposal L2/16-011R3
107 LB8a: ZJ (ID | EB | EM);
111 # LB10: Unattached CM -> AL
116 LB11.1: [^BK CR LF NL SP ZW] CM* WJ;
118 LB11.3: WJ CM* [^CM];
122 LB12a: [^SP BA HY] CM* GL;
124 # LB 13 ICU Tailoring, matches tailoring exmaple 8 from UAX 14.
126 # LB13.1 [^SP] CM* [CL CP EX IS SY] # original UAX 14 rule.
127 # LB13.2 SP CM* [CL CP EX IS SY]
129 LB13.1: [^NU SP] CM* [CL CP IS SY];
130 LB13.2: [^SP] CM* EX;
131 LB13.2: SP [CL CP EX IS SY];
134 # LB 14-17 are moved above LB 7.
139 LB19.1: QU CM* [^CM];
141 # LB 20 Break before and after CB.
142 # Interaction with LB8a: ZJ x ID is tricky because CM includes ZJ.
143 # ZJ acts like a CM to the left, combining with CB.
144 # ZJ acts independently to the right, no break from ID by LB8a.
146 LB20.1a: CB CM* ZJ (ID | EB | EM);
149 # Note: Rule 21a must come before 21 to prevent 21.1 from matching HL BA, then
150 # not picking up the continuing match after the BA from 21a.
151 LB21a: HL CM* (HY | BA) CM* [^CM CB];
153 LB21.1: . CM* [BA HY NS];
154 LB21.2: BB CM* [^CM CB];
158 LB22.1: (AL | HL | CM) CM* IN; # The CM is from LB10, treat an unattached CM as AL.
160 LB22.3: (ID | EB | EM) CM* IN;
161 # LB22.4: IN CM* IN; # delete this rule for CSS loose.
164 LB23.1: (ID | EB | EM) CM* PO;
165 LB23.2: (AL | HL | CM) CM* NU;
166 LB23.3: NU CM* (AL | HL);
168 LB24.1: PR CM* (ID | EB | EM);
169 LB24.2: PR CM* (AL | HL);
170 LB24.3: PO CM* (AL | HL);
171 LB24.4: (AL | HL | CM) CM* (PR | PO);
173 # Numbers. Equivalent to Tailoring example 8 from UAx 14.
174 LB25: ((PR | PO)CM*)? ((OP | HY)CM*)? NU (CM*(NU | SY | IS))* (CM*(CL | CP))? (CM*(PR | PO))?;
176 LB26.1: JL CM* (JL | JV | H2 | H3);
177 LB26.2: (JV | H2) CM* (JV | JT);
178 LB26.3: (JT | H3) CM* JT;
180 LB27.1: (JL | JV | JT | H2 | H3) CM* IN;
181 LB27.2: (JL | JV | JT | H2 | H3) CM* PO;
182 LB27.3: PR CM* (JL | JV | JT | H2 | H3);
184 # LB28 Do not break between Alphabetics.
185 # Unattached (leading) CM treated as AL.
186 LB28: (AL | HL | CM)CM* (AL | HL);
188 LB29: IS CM* (AL | HL);
190 # LB30 is adjusted for unattached leading CM being treated as AL.
191 LB30.1: (AL | CM | HL | NU) CM* OP;
192 LB30.2: CP CM* (AL | HL | NU);
194 # LB31 keep pairs of RI together.
195 LB30a.1: RI CM* RI CM* [BK CR LF NL SP ZW WJ GL CL CP EX IS SY QU BA HY NS];
196 LB30a.2: RI CM* RI CM* ZJ (ID | EB | EM);
197 LB30a.3: RI CM* RI CM* ÷;
199 # LB30b Do not break between Emoji Base and Emoji Modifier
202 # LB31 Break Everywhere Else.
203 # Include combining marks
204 LB31.1: . CM* ZJ (ID | EB | EM);