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