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.
16 AI = [[:LineBreak = Ambiguous:] - [\u2640\u2642]];
17 AL = [[:LineBreak = Alphabetic:]-[\u2764]];
18 BA = [:LineBreak = Break_After:];
19 BB = [:LineBreak = Break_Before:];
20 BK = [:LineBreak = Mandatory_Break:];
21 B2 = [:LineBreak = Break_Both:];
22 CB = [:LineBreak = Contingent_Break:];
23 CJ = [:LineBreak = Conditional_Japanese_Starter:];
24 CL = [:LineBreak = Close_Punctuation:];
25 CM = [[:LineBreak = Combining_Mark:] \u200D];
26 CP = [:LineBreak = Close_Parenthesis:];
27 CR = [:LineBreak = Carriage_Return:];
29 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];
30 EM = [\U0001F3FB-\U0001F3FF];
32 EX = [:LineBreak = Exclamation:];
33 GL = [:LineBreak = Glue:];
34 HL = [:LineBreak = Hebrew_Letter:];
35 HY = [:LineBreak = Hyphen:];
36 H2 = [:LineBreak = H2:];
37 H3 = [:LineBreak = H3:];
38 ID = [[:LineBreak = Ideographic:][\u2640\u2642\u2764]];
39 IN = [:LineBreak = Inseperable:];
40 IS = [:LineBreak = Infix_Numeric:];
41 JL = [:LineBreak = JL:];
42 JV = [:LineBreak = JV:];
43 JT = [:LineBreak = JT:];
44 LF = [:LineBreak = Line_Feed:];
45 NL = [:LineBreak = Next_Line:];
46 NS = [[:LineBreak = Nonstarter:] CJ];
47 NU = [:LineBreak = Numeric:];
48 OP = [:LineBreak = Open_Punctuation:];
49 PO = [:LineBreak = Postfix_Numeric:];
50 PR = [:LineBreak = Prefix_Numeric:];
51 QU = [:LineBreak = Quotation:];
52 RI = [:LineBreak = Regional_Indicator:];
53 SA = [:LineBreak = Complex_Context:];
54 SG = [:LineBreak = Surrogate:];
55 SP = [:LineBreak = Space:];
56 SY = [:LineBreak = Break_Symbols:];
57 WJ = [:LineBreak = Word_Joiner:];
58 XX = [:LineBreak = Unknown:];
59 ZW = [:LineBreak = ZWSpace:];
62 # TODO: adjustment to sets needed only until Unicode properties are updated for Emoji.
66 dictionary = [:LineBreak = Complex_Context:];
68 # Redfine AL. LB1. TODO: refine according to latest UAX.
69 AL = [ AL AI SA SG XX ];
77 LB6: . (BK | CR | LF | NL);
78 LB6.1: [^BK CR LF NL SP ZW] CM* (BK | CR | LF | NL);
81 # Moved before LB7, because they can match a longer sequence that would also match LB7,
82 # for example, the sequence "OP CM SP AL" matches LB14 while the prefix of it,
83 # "while only the prefix "OP CM SP" matches LB7.1
86 LB16: (CL | CP)CM* SP* NS;
89 LB7.1: [^ZW SP] CM* [SP ZW];
90 LB7.2: [ZW SP] [SP ZW];
92 # LB8, ICU differs from UAX-14,
97 # LB8a, from Emoji proposal L2/16-011R3
99 LB8a: ZJ (ID | EB | EM);
103 # LB10: Unattached CM -> AL
108 LB11.1: [^BK CR LF NL SP ZW] CM* WJ;
110 LB11.3: WJ CM* [^CM];
114 LB12a: [^SP BA HY] CM* GL;
116 # LB 13 ICU Tailoring, matches tailoring exmaple 8 from UAX 14.
118 # LB13.1 [^SP] CM* [CL CP EX IS SY] # original UAX 14 rule.
119 # LB13.2 SP CM* [CL CP EX IS SY]
121 LB13.1: [^NU SP] CM* [CL CP IS SY];
122 LB13.2: [^SP] CM* EX;
123 LB13.2: SP [CL CP EX IS SY];
126 # LB 14-17 are moved above LB 7.
131 LB19.1: QU CM* [^CM];
133 # LB 20 Break before and after CB.
134 # Interaction with LB8a: ZJ x ID is tricky because CM includes ZJ.
135 # ZJ acts like a CM to the left, combining with CB.
136 # ZJ acts independently to the right, no break from ID by LB8a.
138 LB20.1a: CB CM* ZJ (ID | EB | EM);
141 # Note: Rule 21a must come before 21 to prevent 21.1 from matching HL BA, then
142 # not picking up the continuing match after the BA from 21a.
143 LB21a: HL CM* (HY | BA) CM* [^CM CB];
145 LB21.1: . CM* [BA HY NS];
146 LB21.2: BB CM* [^CM CB];
150 LB22.1: (AL | HL | CM) CM* IN; # The CM is from LB10, treat an unattached CM as AL.
152 LB22.3: (ID | EB | EM) CM* IN;
156 LB23.1: (ID | EB | EM) CM* PO;
157 LB23.2: (AL | HL | CM) CM* NU;
158 LB23.3: NU CM* (AL | HL);
160 LB24.1: PR CM* (ID | EB | EM);
161 LB24.2: PR CM* (AL | HL);
162 LB24.3: PO CM* (AL | HL);
163 LB24.4: (AL | HL | CM) CM* (PR | PO);
165 # Numbers. Equivalent to Tailoring example 8 from UAX 14.
166 LB25: ((PR | PO)CM*)? ((OP | HY)CM*)? NU (CM*(NU | SY | IS))* (CM*(CL | CP))? (CM*(PR | PO))?;
168 LB26.1: JL CM* (JL | JV | H2 | H3);
169 LB26.2: (JV | H2) CM* (JV | JT);
170 LB26.3: (JT | H3) CM* JT;
172 LB27.1: (JL | JV | JT | H2 | H3) CM* IN;
173 LB27.2: (JL | JV | JT | H2 | H3) CM* PO;
174 LB27.3: PR CM* (JL | JV | JT | H2 | H3);
176 # LB28 Do not break between Alphabetics.
177 # Unattached (leading) CM treated as AL.
178 LB28: (AL | HL | CM)CM* (AL | HL);
180 LB29: IS CM* (AL | HL);
182 # LB30 is adjusted for unattached leading CM being treated as AL.
183 LB30.1: (AL | CM | HL | NU) CM* OP;
184 LB30.2: CP CM* (AL | HL | NU);
186 # LB31 keep pairs of RI together.
187 LB30a.1: RI CM* RI CM* [BK CR LF NL SP ZW WJ GL CL CP EX IS SY QU BA HY NS];
188 LB30a.2: RI CM* RI CM* ZJ (ID | EB | EM);
189 LB30a.3: RI CM* RI CM* ÷;
191 # LB30b Do not break between Emoji Base and Emoji Modifier
194 # LB31 Break Everywhere Else.
195 # Include combining marks
196 LB31.1: . CM* ZJ (ID | EB | EM);