]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/testdata/break_rules/line_loose.txt
5cfde20d0876407b8ba304de618c60ef16b7c6dc
[apple/icu.git] / icuSources / test / testdata / break_rules / line_loose.txt
1 #
2 # Copyright (c) 2016, International Business Machines Corporation and others. All Rights Reserved.
3 #
4 # file: line_loose.txt
5 #
6 # Reference Line Break rules for intltest rbbi/RBBIMonkeyTest
7 #
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.
10 #
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
13 # Chinese & Japanese.
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
18
19 type = line;
20 locale = en@lb=loose;
21
22
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:];
35
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];
38
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:];
68 ZJ = [\u200D];
69
70 # TODO: adjustment to sets needed only until Unicode properties are updated for Emoji.
71 ID = [ID - EB];
72 AL = [AL - EM];
73
74 dictionary = [:LineBreak = Complex_Context:];
75
76 # Redfine AL. LB1. TODO: refine according to latest UAX.
77 AL = [ AL AI SA SG XX ];
78
79 LB4: BK ÷;
80 LB5: CR LF;
81 LB5.1: CR ÷;
82 LB5.2: LF ÷;
83 LB5.3: NL ÷;
84
85 LB6: . (BK | CR | LF | NL);
86 LB6.1: [^BK CR LF NL SP ZW] CM* (BK | CR | LF | NL);
87
88 # Rules LB14 - LB17.
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
92 LB14: OP CM* SP* .;
93 LB15: QU CM* SP* OP;
94 LB16: (CL | CP)CM* SP* NS;
95 LB17: B2 CM* SP* B2;
96
97 LB7.1: [^ZW SP] CM* [SP ZW];
98 LB7.2: [ZW SP] [SP ZW];
99
100 # LB8, ICU differs from UAX-14,
101 # ICU: ZW ÷;
102 # UAX 14: ZW SP* ÷;
103 LB8: ZW ÷;
104
105 # LB8a, from Emoji proposal L2/16-011R3
106 # ZWJ x ID
107 LB8a: ZJ (ID | EB | EM);
108
109
110 # LB9: X CM -> X
111 # LB10: Unattached CM -> AL
112
113 #LB11: × WJ;
114 # WJ ×
115
116 LB11.1: [^BK CR LF NL SP ZW] CM* WJ;
117 LB11.2: SP WJ;
118 LB11.3: WJ CM* [^CM];
119
120 LB12: GL CM* [^CM];
121
122 LB12a: [^SP BA HY] CM* GL;
123
124 # LB 13 ICU Tailoring, matches tailoring exmaple 8 from UAX 14.
125 #
126 # LB13.1 [^SP] CM* [CL CP EX IS SY] # original UAX 14 rule.
127 # LB13.2 SP CM* [CL CP EX IS SY]
128
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];
132
133
134 # LB 14-17 are moved above LB 7.
135
136 LB18: SP ÷;
137
138 LB19: . CM* QU;
139 LB19.1: QU CM* [^CM];
140
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.
145 LB20: . CM* ÷ CB;
146 LB20.1a: CB CM* ZJ (ID | EB | EM);
147 LB20.1b: CB CM* ÷;
148
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];
152
153 LB21.1: . CM* [BA HY NS];
154 LB21.2: BB CM* [^CM CB];
155
156 LB21b: SY CM* HL;
157
158 LB22.1: (AL | HL | CM) CM* IN; # The CM is from LB10, treat an unattached CM as AL.
159 LB22.2: EX CM* IN;
160 LB22.3: (ID | EB | EM) CM* IN;
161 # LB22.4: IN CM* IN; # delete this rule for CSS loose.
162 LB22.5: NU CM* IN;
163
164 LB23.1: (ID | EB | EM) CM* PO;
165 LB23.2: (AL | HL | CM) CM* NU;
166 LB23.3: NU CM* (AL | HL);
167
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);
172
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))?;
175
176 LB26.1: JL CM* (JL | JV | H2 | H3);
177 LB26.2: (JV | H2) CM* (JV | JT);
178 LB26.3: (JT | H3) CM* JT;
179
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);
183
184 # LB28 Do not break between Alphabetics.
185 # Unattached (leading) CM treated as AL.
186 LB28: (AL | HL | CM)CM* (AL | HL);
187
188 LB29: IS CM* (AL | HL);
189
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);
193
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* ÷;
198
199 # LB30b Do not break between Emoji Base and Emoji Modifier
200 LB30b: EB CM* EM;
201
202 # LB31 Break Everywhere Else.
203 # Include combining marks
204 LB31.1: . CM* ZJ (ID | EB | EM);
205 LB31.2: . CM* ÷;