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