]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/testdata/break_rules/line_normal_cj.txt
ICU-66108.tar.gz
[apple/icu.git] / icuSources / test / testdata / break_rules / line_normal_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_normal_cj.txt
7 #
8 # Reference Line Break rules for intltest rbbi/RBBIMonkeyTest.
9 # Rules derived from Unicode Standard Annex #14 Revision 44 for Unicode 13.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 hyphens 2010 & 2013 (both BA) and 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 AL = [:LineBreak = Alphabetic:];
31 BAX = [\u2010 \u2013];
32 BA = [[:LineBreak = Break_After:] - BAX];
33 HH = [\u2010]; # \u2010 is HYPHEN, default line break is BA.
34 BB = [:LineBreak = Break_Before:];
35 BK = [:LineBreak = Mandatory_Break:];
36 B2 = [:LineBreak = Break_Both:];
37 CB = [:LineBreak = Contingent_Break:];
38 CJ = [:LineBreak = Conditional_Japanese_Starter:];
39 CL = [[:LineBreak = Close_Punctuation:] \u201d];
40 CMS = [:LineBreak = Combining_Mark:];
41 CP = [:LineBreak = Close_Parenthesis:];
42 CR = [:LineBreak = Carriage_Return:];
43 EB = [[:LineBreak = EB:] \U0001F46A-\U0001F46D\U0001F46F\U0001F91D\U0001F93C];
44 EM = [:LineBreak = EM:];
45 EX = [:LineBreak = Exclamation:];
46 GL = [:LineBreak = Glue:];
47 HL = [:LineBreak = Hebrew_Letter:];
48 HY = [:LineBreak = Hyphen:];
49 H2 = [:LineBreak = H2:];
50 H3 = [:LineBreak = H3:];
51 ID = [[:LineBreak = Ideographic:] CJ]; # CSS Normal tailoring: CJ resolves to ID
52 IN = [:LineBreak = Inseperable:];
53 IS = [:LineBreak = Infix_Numeric:];
54 JL = [:LineBreak = JL:];
55 JV = [:LineBreak = JV:];
56 JT = [:LineBreak = JT:];
57 LF = [:LineBreak = Line_Feed:];
58 NL = [:LineBreak = Next_Line:];
59 NSX = [\u301C \u30A0];
60 NS = [[:LineBreak = Nonstarter:] - NSX];
61 NU = [:LineBreak = Numeric:];
62 OP = [[:LineBreak = Open_Punctuation:] \u201c];
63 PO = [:LineBreak = Postfix_Numeric:];
64 PR = [:LineBreak = Prefix_Numeric:];
65 QU = [[:LineBreak = Quotation:] - [\u201c\u201d]];
66 RI = [:LineBreak = Regional_Indicator:];
67 SA = [:LineBreak = Complex_Context:];
68 SG = [:LineBreak = Surrogate:];
69 SP = [:LineBreak = Space:];
70 SY = [:LineBreak = Break_Symbols:];
71 WJ = [:LineBreak = Word_Joiner:];
72 XX = [:LineBreak = Unknown:];
73 ZW = [:LineBreak = ZWSpace:];
74 ZWJ = [:LineBreak = ZWJ:];
75
76 # OP30 and CP30 are variants of OP and CP that appear in rule LB30 from UAX 14.
77 # Limitations of this monkey test rule parser require that these definitions be pulled out
78 # rather than appearing in-line in LB 30.
79
80 OP30 = [OP - [\p{ea=F}\p{ea=W}\p{ea=H}]];
81 CP30 = [CP - [\p{ea=F}\p{ea=W}\p{ea=H}]];
82
83 # LB1 - Resolve AI, CB, CJ, SA, SG, and XX into other line breaking classes
84 AL = [AL AI SG XX ];
85 dictionary = SA;
86
87 # By LB9, a ZWJ also behaves as a CM. Including it in the definition of CM avoids having to explicitly
88 # list it in the numerous rules that use CM.
89 CM = [CMS ZWJ];
90
91 LB4: BK ÷;
92 LB5: CR LF;
93 LB5.1: CR ÷;
94 LB5.2: LF ÷;
95 LB5.3: NL ÷;
96
97 LB6: . (BK | CR | LF | NL);
98 LB6.1: [^BK CR LF NL SP ZW] CM* (BK | CR | LF | NL);
99
100 # LB8 break after ZW SP*.
101 # Precedes LB7 because both rules will match the sequences like ZW SP,
102 # and LB8 must take precedence.
103
104 LB8: ZW SP* ÷ [^ZW SP BK CR LF NL];
105
106 # Numbers. Equivalent to Tailoring example 8 from UAX 14.
107 # Moved up, before LB14, because it can match longer sequences which must take precedence.
108 LB25: ((PR | PO)CM*)? ((OP | HY)CM*)? (IS CM*)? NU (CM*(NU | SY | IS))* (CM*(CL | CP))? (CM*(PR | PO))?;
109
110 # Rules LB14 - LB17.
111 # Moved up, before LB7, because they can match a longer sequence that would also match LB7.
112 # For example, the sequence "OP CM SP AL" matches LB14
113 # while the prefix of it, "OP CM SP" matches LB7.1
114 LB14: OP CM* SP* .;
115
116 # LB 14a Break before an IS that begins a number and follows a space.
117 LB14a: SP ÷ IS CM* NU;
118
119 # LB14b × IS
120 LB14b.1: [^SP] CM* IS;
121 LB14b.2: SP IS;
122
123 LB15: QU CM* SP* OP;
124
125 # Do not break between closing punctuation and $NS, even with intervening spaces
126 # But DO allow a break between closing punctuation and $NSX, don't include it here
127 LB16: (CL | CP)CM* SP* NS;
128 LB17: B2 CM* SP* B2;
129
130 # LB7 Do not break before spaces or zero width space.
131
132 LB7.1: [^ZW SP] CM* [SP ZW];
133 LB7.2: [ZW SP] [SP ZW];
134
135 # LB8a
136 # ZWJ x
137 # Don't match a CM on the right - let other rules pick up CM sequences, where
138 # the ZWJ behaves as just another generic CM.
139 LB8a: ZWJ [^CM];
140
141
142 # LB9: X CM -> X
143 # LB10: Unattached CM -> AL
144
145 #LB11: × WJ;
146 # WJ ×
147
148 LB11.1: [^SP] CM* WJ;
149 LB11.2: SP WJ;
150 LB11.3: WJ CM* [^CM];
151
152 LB12: GL CM* [^CM];
153
154 LB12a: [^SP BA BAX HY] CM* GL;
155
156 # LB 13 Do not break before ‘]’ or ‘!’ or ‘/’, even after spaces.
157 LB13.1: [^SP] CM* [CL CP EX SY];
158 LB13.2: SP [CL CP EX SY];
159
160 # LB 14-17 are moved above LB 7.
161
162 LB18: SP ÷;
163
164 LB19: . CM* QU;
165 LB19.1: QU CM* [^CM];
166
167 # LB 20 Break before and after CB.
168 # Interaction with LB8a: ZWJ x . is tricky because CM includes ZWJ.
169 # ZWJ acts like a CM to the left, combining with CB.
170 # ZWJ acts independently to the right, no break after by LB8a.
171 LB20.1: . CM* ZWJ CB;
172 LB20.2: . CM* ÷ CB;
173
174 LB20.3: CB CM* ZWJ [^CM];
175 LB20.4: CB CM* ÷;
176
177 # LB 20.09 Don't break between Hyphens and Letters when there is a break preceding the hyphen.
178 LB20.09: ^(HY | HH) CM* AL;
179
180 # Note: Rule 21a must come before 21 to prevent 21.1 from matching HL BA, then
181 # not picking up the continuing match after the BA from 21a.
182 # TODO: For CJ tailorings (with BAX) does this rule want to include BAX? If so,
183 # should "HL BAX" not break when followed by a CB? Thats what the current
184 # rules do, which is why "[^CM CB]?" includes the ?.
185 LB21a: HL CM* (HY | BA | BAX) CM* [^CM CB]?;
186
187 # DO allow breaks here before $BAXcm and $NSXcm, so don't include them
188 LB21.1: . CM* [BA HY NS];
189 LB21.2: BB CM* [^CM CB];
190
191 LB21b: SY CM* HL;
192
193 LB22: . CM* IN;
194
195 LB23.1: (AL | HL | CM) CM* NU;
196 LB23.2: NU CM* (AL | HL);
197
198 LB23a.1: PR CM* (ID | EB | EM);
199 LB23a.2: (ID | EB | EM) CM* PO;
200
201 LB24.2: (PR | PO) CM* (AL | HL);
202 LB24.3: (AL | HL | CM) CM* (PR | PO);
203
204 LB26.1: JL CM* (JL | JV | H2 | H3);
205 LB26.2: (JV | H2) CM* (JV | JT);
206 LB26.3: (JT | H3) CM* JT;
207
208 LB27.1: (JL | JV | JT | H2 | H3) CM* IN;
209 LB27.2: (JL | JV | JT | H2 | H3) CM* PO;
210 LB27.3: PR CM* (JL | JV | JT | H2 | H3);
211
212 # LB28 Do not break between Alphabetics.
213 # Unattached (leading) CM treated as AL.
214 LB28: (AL | HL | CM)CM* (AL | HL);
215
216 LB29: IS CM* (AL | HL);
217
218 # LB30 is adjusted for unattached leading CM being treated as AL.
219 LB30.1: (AL | CM | HL | NU) CM* OP30;
220 LB30.2: CP30 CM* (AL | HL | NU);
221
222 # LB30a keep pairs of RI together.
223 LB30a.1: RI CM* RI ÷ [^BK CR LF NL SP ZW WJ CL CP EX IS SY GL QU BA HY NS IN CM];
224 LB30a.2: RI CM* RI CM* CMS ÷ [^BK CR LF NL SP ZW WJ CL CP EX IS SY GL QU BA HY NS IN CM];
225 LB30a.3: RI CM* RI CM* [BK CR LF NL SP ZW WJ GL CL CP EX IS SY QU BA HY NS IN ZWJ]?;
226
227 # LB30b Do not break between Emoji Base and Emoji Modifier
228 LB30b: EB CM* EM;
229
230 # LB31 Break Everywhere Else.
231 # Include combining marks
232 LB31.1: . CM* ZWJ [^CM];
233 LB31.2: . CM* ÷;