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