]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/testdata/break_rules/line_loose_cj.txt
ICU-62141.0.1.tar.gz
[apple/icu.git] / icuSources / test / testdata / break_rules / line_loose_cj.txt
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_cj.txt
7 #
8 # Reference Line Break rules for intltest rbbi/RBBIMonkeyTest.
9 # Rules derived from Unicode Standard Annex #14 Revision 40 for Unicode 11.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 Revision 34 for Unicode 8.0
17 # http://www.unicode.org/reports/tr14/
18 # tailored as noted in 2nd paragraph below..
19 #
20 # This tailors the line break behavior to correspond to CSS
21 # line-break=loose (BCP47 -u-lb-loose) as defined for Chinese & Japanese.
22 # It sets characters of class CJ to behave like ID.
23 # In addition, it allows breaks:
24 # * before hyphens 2010 & 2013 (both BA) and 301C, 30A0 (both NS)
25 # * before iteration marks 3005, 303B, 309D, 309E, 30FD, 30FE (all NS)
26 # * between characters of LineBreak class IN such as 2026
27 # * before some centered punct 203C, 2047, 2048, 2049, 30FB, FF1A, FF1B,
28 # FF65 (all NS) and FF01, FF1F (both EX).
29 # * before suffix characters with LineBreak class PO and EastAsianWidth A,F,W;
30 # this includes: 00B0 2030 2032 2033 2035 2103 2109 FE6A FF05 FFE0
31 # * after prefix characters with LineBreak class PR and EastAsianWidth A,F,W;
32 # this includes: 00A4 00B1 20AC 2116 FE69 FF04 FFE1 FFE5 FFE6
33
34
35 type = line;
36 locale = ja@lb=loose;
37
38
39 AI = [:LineBreak = Ambiguous:];
40 AL = [[:LineBreak = Alphabetic:]];
41 BAX = [\u2010 \u2013];
42 BA = [[:LineBreak = Break_After:] - BAX];
43 BB = [:LineBreak = Break_Before:];
44 BK = [:LineBreak = Mandatory_Break:];
45 B2 = [:LineBreak = Break_Both:];
46 CB = [:LineBreak = Contingent_Break:];
47 CJ = [:LineBreak = Conditional_Japanese_Starter:];
48 CL = [:LineBreak = Close_Punctuation:];
49 CM = [:LineBreak = Combining_Mark:];
50 CP = [:LineBreak = Close_Parenthesis:];
51 CR = [:LineBreak = Carriage_Return:];
52 EB = [[:LineBreak = EB:] \U0001F46A-\U0001F46D\U0001F46F\U0001F91D\U0001F93C];
53 EM = [:LineBreak = EM:];
54 EXX = [\uFF01 \uFF1F];
55 EX = [[:LineBreak = Exclamation:] - EXX];
56 GL = [:LineBreak = Glue:];
57 HL = [:LineBreak = Hebrew_Letter:];
58 HY = [:LineBreak = Hyphen:];
59 H2 = [:LineBreak = H2:];
60 H3 = [:LineBreak = H3:];
61 ID = [[:LineBreak = Ideographic:] CJ]; # CSS Loose tailoring: CJ resolves to ID
62 IN = [:LineBreak = Inseperable:];
63 IS = [:LineBreak = Infix_Numeric:];
64 JL = [:LineBreak = JL:];
65 JV = [:LineBreak = JV:];
66 JT = [:LineBreak = JT:];
67 LF = [:LineBreak = Line_Feed:];
68 NL = [:LineBreak = Next_Line:];
69 NSX = [\u301C \u30A0 \u3005 \u303B \u309D \u309E \u30FD \u30FE \u203C \u2047 \u2048 \u2049 \u30FB \uFF1A \uFF1B \uFF65];
70 NS = [[:LineBreak = Nonstarter:] - NSX];
71 NU = [:LineBreak = Numeric:];
72 OP = [:LineBreak = Open_Punctuation:];
73 POX = [\u00B0 \u2030 \u2032 \u2033 \u2035 \u2103 \u2109 \uFE6A \uFF05 \uFFE0];
74 PO = [[:LineBreak = Postfix_Numeric:] - POX];
75 PRX = [\u00A4 \u00B1 \u20AC \u2116 \uFE69 \uFF04 \uFFE1 \uFFE5 \uFFE6];
76 PR = [[:LineBreak = Prefix_Numeric:] - PRX];
77 QU = [:LineBreak = Quotation:];
78 RI = [:LineBreak = Regional_Indicator:];
79 SA = [:LineBreak = Complex_Context:];
80 SG = [:LineBreak = Surrogate:];
81 SP = [:LineBreak = Space:];
82 SY = [:LineBreak = Break_Symbols:];
83 WJ = [:LineBreak = Word_Joiner:];
84 XX = [:LineBreak = Unknown:];
85 ZW = [:LineBreak = ZWSpace:];
86 ZWJ = [:LineBreak = ZWJ:];
87
88 # LB1 - Resolve AI, CB, CJ, SA, SG, and XX into other line breaking classes
89 AL = [AL AI SG XX ];
90 dictionary = SA;
91
92 # By LB9, a ZWJ also behaves as a CM. Including it in the definition of CM avoids having to explicitly
93 # list it in the numerous rules that use CM.
94 CM = [CM ZWJ];
95
96 LB4: BK ÷;
97 LB5: CR LF;
98 LB5.1: CR ÷;
99 LB5.2: LF ÷;
100 LB5.3: NL ÷;
101
102 LB6: . (BK | CR | LF | NL);
103 LB6.1: [^BK CR LF NL SP ZW] CM* (BK | CR | LF | NL);
104
105 # Rules LB14 - LB17.
106 # Moved before LB7, because they can match a longer sequence that would also match LB7,
107 # for example, the sequence "OP CM SP AL" matches LB14 while the prefix of it,
108 # "while only the prefix "OP CM SP" matches LB7.1
109 LB14: OP CM* SP* .;
110 LB15: QU CM* SP* OP;
111 LB16: (CL | CP)CM* SP* NS;
112 LB17: B2 CM* SP* B2;
113
114 LB7.1: [^ZW SP] CM* [SP ZW];
115 LB7.2: [ZW SP] [SP ZW];
116
117 # LB8, ICU differs from UAX-14,
118 # ICU: ZW ÷;
119 # UAX 14: ZW SP* ÷;
120 LB8: ZW ÷;
121
122 # LB8a
123 # ZWJ x
124 # Don't match a CM on the right - let other rules pick up CM sequences, where
125 # the ZWJ behaves as just another generic CM.
126 LB8a: ZWJ [^CM];
127
128
129 # LB9: X CM -> X
130 # LB10: Unattached CM -> AL
131
132 #LB11: × WJ;
133 # WJ ×
134
135 LB11.1: [^SP] CM* WJ;
136 LB11.2: SP WJ;
137 LB11.3: WJ CM* [^CM];
138
139 LB12: GL CM* [^CM];
140
141 LB12a: [^SP BA BAX HY] CM* GL;
142
143 # LB 13 ICU Tailoring, matches tailoring exmaple 8 from UAX 14.
144 #
145 # LB13.1 [^SP] CM* [CL CP EX IS SY] # original UAX 14 rule.
146 # LB13.2 SP CM* [CL CP EX IS SY]
147
148 LB13.1: [^NU SP] CM* [CL CP IS SY];
149 LB13.2: [^SP] CM* EX;
150 LB13.2: SP [CL CP EX IS SY];
151
152
153 # LB 14-17 are moved above LB 7.
154
155 LB18: SP ÷;
156
157 LB19: . CM* QU;
158 LB19.1: QU CM* [^CM];
159
160 # LB 20 Break before and after CB.
161 # Interaction with LB8a: ZWJ x . is tricky because CM includes ZWJ.
162 # ZWJ acts like a CM to the left, combining with CB.
163 # ZWJ acts independently to the right, no break after by LB8a.
164 LB20.1: . CM* ZWJ CB;
165 LB20.2: . CM* ÷ CB;
166
167 LB20.3: CB CM* ZWJ [^CM];
168 LB20.4: CB CM* ÷;
169
170 # Note: Rule 21a must come before 21 to prevent 21.1 from matching HL BA, then
171 # not picking up the continuing match after the BA from 21a.
172 # LB 21a Don't break after Hebrew + Hyphen
173 # HL (HY | BA) x
174
175 LB21a: HL CM* (HY | BA | BAX) CM* [^CM CB]?;
176
177 LB21.1: . CM* [BA HY NS];
178 LB21.2: BB CM* [^CM CB];
179
180 LB21b: SY CM* HL;
181
182 LB22.1: (AL | HL | CM) CM* IN; # The CM is from LB10, treat an unattached CM as AL.
183 LB22.2: EX CM* IN;
184 LB22.3: (ID | EB | EM) CM* IN;
185 # LB22.4: IN CM* IN; # delete this rule for CSS loose.
186 LB22.5: NU CM* IN;
187
188 LB23.1: (AL | HL | CM) CM* NU;
189 LB23.2: NU CM* (AL | HL);
190
191 LB23a.1: PR CM* (ID | EB | EM);
192 LB23a.2: (ID | EB | EM) CM* PO;
193
194 LB24.2: (PR | PO | POX) CM* (AL | HL);
195 LB24.3: (AL | HL | CM) CM* (PR | PO | POX);
196
197 # Numbers. Equivalent to Tailoring example 8 from UAx 14.
198 # Loose_cj tailoring: do not include $PRX at the beginning or $POX at the end.
199 LB25: ((PR | PO | POX)CM*)? ((OP | HY)CM*)? NU (CM*(NU | SY | IS))* (CM*(CL | CP))? (CM*(PR | PRX | PO))?;
200
201 LB26.1: JL CM* (JL | JV | H2 | H3);
202 LB26.2: (JV | H2) CM* (JV | JT);
203 LB26.3: (JT | H3) CM* JT;
204
205 LB27.1: (JL | JV | JT | H2 | H3) CM* IN;
206 LB27.2: (JL | JV | JT | H2 | H3) CM* PO;
207 LB27.3: PR CM* (JL | JV | JT | H2 | H3);
208
209 # LB28 Do not break between Alphabetics.
210 # Unattached (leading) CM treated as AL.
211 LB28: (AL | HL | CM)CM* (AL | HL);
212
213 LB29: IS CM* (AL | HL);
214
215 # LB30 is adjusted for unattached leading CM being treated as AL.
216 LB30.1: (AL | CM | HL | NU) CM* OP;
217 LB30.2: CP CM* (AL | HL | NU);
218
219 # LB30a keep pairs of RI together.
220 LB30a.1: RI CM* RI ÷ [^BK CR LF NL SP ZW WJ CL CP EX IS SY GL QU BA HY NS CM];
221 LB30a.2: RI CM* RI CM* [CM-ZWJ] ÷ [^BK CR LF NL SP ZW WJ CL CP EX IS SY GL QU BA HY NS CM];
222 LB30a.3: RI CM* RI CM* [BK CR LF NL SP ZW WJ GL CL CP EX IS SY QU BA HY NS ZWJ]?;
223
224 # LB30b Do not break between Emoji Base and Emoji Modifier
225 LB30b: EB CM* EM;
226
227 # LB31 Break Everywhere Else.
228 # Include combining marks
229 LB31.1: . CM* ZWJ [^CM];
230 LB31.2: . CM* ÷;