]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/testdata/break_rules/line_normal.txt
ICU-57132.0.1.tar.gz
[apple/icu.git] / icuSources / test / testdata / break_rules / line_normal.txt
CommitLineData
2ca993e8
A
1#
2# Copyright (c) 2016, International Business Machines Corporation and others. All Rights Reserved.
3#
4# file: line_normal.txt
5#
6# Reference Line Break rules for intltest rbbi/RBBIMonkeyTest
7#
8# Note: Rule syntax and the monkey test itself are still a work in progress.
9# They are expected to change with review and the addition of support for rule tailoring.
10#
11# Line Breaking Rules
12# Implement default line breaking as defined by
13# Unicode Standard Annex #14 Revision 34 for Unicode 8.0
14# http://www.unicode.org/reports/tr14/
15# tailored as noted in 2nd paragraph below..
16#
17# TODO: Rule LB 8 remains as it was in Unicode 5.2
18# This is only because of a limitation of ICU break engine implementation,
19# not because the older behavior is desirable.
20#
21# This tailors the line break behavior to correspond to CSS
22# line-break=normal (BCP47 -u-lb-normal) as defined for languages other than
23# Chinese & Japanese.
24# It sets characters of class CJ to behave like ID.
25
26
27type = line;
28locale = en@lb=normal;
29
30AI = [[:LineBreak = Ambiguous:] - [\u2640\u2642]];
31AL = [[:LineBreak = Alphabetic:]-[\u2764]];
32BA = [:LineBreak = Break_After:];
33BB = [:LineBreak = Break_Before:];
34BK = [:LineBreak = Mandatory_Break:];
35B2 = [:LineBreak = Break_Both:];
36CB = [:LineBreak = Contingent_Break:];
37CJ = [:LineBreak = Conditional_Japanese_Starter:];
38CL = [:LineBreak = Close_Punctuation:];
39CM = [[:LineBreak = Combining_Mark:] \u200D];
40CP = [:LineBreak = Close_Parenthesis:];
41CR = [:LineBreak = Carriage_Return:];
42
43EB = [\u261D\u26F9\u270A-\u270D\U0001F385\U0001F3C3-\U0001F3C4\U0001F3CA-\U0001F3CB\U0001F442-\U0001F443\U0001F446-\U0001F450\U0001F466-\U0001F469\U0001F46E\U0001F470-\U0001F478\U0001F47C\U0001F481-\U0001F483\U0001F485-\U0001F487\U0001F4AA\U0001F575\U0001F590\U0001F595-\U0001F596\U0001F645-\U0001F647\U0001F64B-\U0001F64F\U0001F6A3\U0001F6B4-\U0001F6B6\U0001F6C0\U0001F918];
44EM = [\U0001F3FB-\U0001F3FF];
45
46EX = [:LineBreak = Exclamation:];
47GL = [:LineBreak = Glue:];
48HL = [:LineBreak = Hebrew_Letter:];
49HY = [:LineBreak = Hyphen:];
50H2 = [:LineBreak = H2:];
51H3 = [:LineBreak = H3:];
52ID = [[:LineBreak = Ideographic:] CJ [\u2640\u2642\u2764]];
53IN = [:LineBreak = Inseperable:];
54IS = [:LineBreak = Infix_Numeric:];
55JL = [:LineBreak = JL:];
56JV = [:LineBreak = JV:];
57JT = [:LineBreak = JT:];
58LF = [:LineBreak = Line_Feed:];
59NL = [:LineBreak = Next_Line:];
60NS = [:LineBreak = Nonstarter:];
61NU = [:LineBreak = Numeric:];
62OP = [:LineBreak = Open_Punctuation:];
63PO = [:LineBreak = Postfix_Numeric:];
64PR = [:LineBreak = Prefix_Numeric:];
65QU = [:LineBreak = Quotation:];
66RI = [:LineBreak = Regional_Indicator:];
67SA = [:LineBreak = Complex_Context:];
68SG = [:LineBreak = Surrogate:];
69SP = [:LineBreak = Space:];
70SY = [:LineBreak = Break_Symbols:];
71WJ = [:LineBreak = Word_Joiner:];
72XX = [:LineBreak = Unknown:];
73ZW = [:LineBreak = ZWSpace:];
74ZJ = [\u200D];
75
76# TODO: adjustment to sets needed only until Unicode properties are updated for Emoji.
77ID = [ID - EB];
78AL = [AL - EM];
79
80dictionary = [:LineBreak = Complex_Context:];
81
82# Redfine AL. LB1. TODO: refine according to latest UAX.
83AL = [ AL AI SA SG XX ];
84
85LB4: BK ÷;
86LB5: CR LF;
87LB5.1: CR ÷;
88LB5.2: LF ÷;
89LB5.3: NL ÷;
90
91LB6: . (BK | CR | LF | NL);
92LB6.1: [^BK CR LF NL SP ZW] CM* (BK | CR | LF | NL);
93
94# Rules LB14 - LB17.
95# Moved before LB7, because they can match a longer sequence that would also match LB7,
96# for example, the sequence "OP CM SP AL" matches LB14 while the prefix of it,
97# "while only the prefix "OP CM SP" matches LB7.1
98LB14: OP CM* SP* .;
99LB15: QU CM* SP* OP;
100LB16: (CL | CP)CM* SP* NS;
101LB17: B2 CM* SP* B2;
102
103LB7.1: [^ZW SP] CM* [SP ZW];
104LB7.2: [ZW SP] [SP ZW];
105
106# LB8, ICU differs from UAX-14,
107# ICU: ZW ÷;
108# UAX 14: ZW SP* ÷;
109LB8: ZW ÷;
110
111# LB8a, from Emoji proposal L2/16-011R3
112# ZWJ x ID
113LB8a: ZJ (ID | EB | EM);
114
115
116# LB9: X CM -> X
117# LB10: Unattached CM -> AL
118
119#LB11: × WJ;
120# WJ ×
121
122LB11.1: [^BK CR LF NL SP ZW] CM* WJ;
123LB11.2: SP WJ;
124LB11.3: WJ CM* [^CM];
125
126LB12: GL CM* [^CM];
127
128LB12a: [^SP BA HY] CM* GL;
129
130# LB 13 ICU Tailoring, matches tailoring exmaple 8 from UAX 14.
131#
132# LB13.1 [^SP] CM* [CL CP EX IS SY] # original UAX 14 rule.
133# LB13.2 SP CM* [CL CP EX IS SY]
134
135LB13.1: [^NU SP] CM* [CL CP IS SY];
136LB13.2: [^SP] CM* EX;
137LB13.2: SP [CL CP EX IS SY];
138
139
140# LB 14-17 are moved above LB 7.
141
142LB18: SP ÷;
143
144LB19: . CM* QU;
145LB19.1: QU CM* [^CM];
146
147# LB 20 Break before and after CB.
148# Interaction with LB8a: ZJ x ID is tricky because CM includes ZJ.
149# ZJ acts like a CM to the left, combining with CB.
150# ZJ acts independently to the right, no break from ID by LB8a.
151LB20: . CM* ÷ CB;
152LB20.1a: CB CM* ZJ (ID | EB | EM);
153LB20.1b: CB CM* ÷;
154
155# Note: Rule 21a must come before 21 to prevent 21.1 from matching HL BA, then
156# not picking up the continuing match after the BA from 21a.
157LB21a: HL CM* (HY | BA) CM* [^CM CB];
158
159LB21.1: . CM* [BA HY NS];
160LB21.2: BB CM* [^CM CB];
161
162LB21b: SY CM* HL;
163
164LB22.1: (AL | HL | CM) CM* IN; # The CM is from LB10, treat an unattached CM as AL.
165LB22.2: EX CM* IN;
166LB22.3: (ID | EB | EM) CM* IN;
167LB22.4: IN CM* IN;
168LB22.5: NU CM* IN;
169
170LB23.1: (ID | EB | EM) CM* PO;
171LB23.2: (AL | HL | CM) CM* NU;
172LB23.3: NU CM* (AL | HL);
173
174LB24.1: PR CM* (ID | EB | EM);
175LB24.2: PR CM* (AL | HL);
176LB24.3: PO CM* (AL | HL);
177LB24.4: (AL | HL | CM) CM* (PR | PO);
178
179# Numbers. Equivalent to Tailoring example 8 from UAx 14.
180LB25: ((PR | PO)CM*)? ((OP | HY)CM*)? NU (CM*(NU | SY | IS))* (CM*(CL | CP))? (CM*(PR | PO))?;
181
182LB26.1: JL CM* (JL | JV | H2 | H3);
183LB26.2: (JV | H2) CM* (JV | JT);
184LB26.3: (JT | H3) CM* JT;
185
186LB27.1: (JL | JV | JT | H2 | H3) CM* IN;
187LB27.2: (JL | JV | JT | H2 | H3) CM* PO;
188LB27.3: PR CM* (JL | JV | JT | H2 | H3);
189
190# LB28 Do not break between Alphabetics.
191# Unattached (leading) CM treated as AL.
192LB28: (AL | HL | CM)CM* (AL | HL);
193
194LB29: IS CM* (AL | HL);
195
196# LB30 is adjusted for unattached leading CM being treated as AL.
197LB30.1: (AL | CM | HL | NU) CM* OP;
198LB30.2: CP CM* (AL | HL | NU);
199
200# LB31 keep pairs of RI together.
201LB30a.1: RI CM* RI CM* [BK CR LF NL SP ZW WJ GL CL CP EX IS SY QU BA HY NS];
202LB30a.2: RI CM* RI CM* ZJ (ID | EB | EM);
203LB30a.3: RI CM* RI CM* ÷;
204
205# LB30b Do not break between Emoji Base and Emoji Modifier
206LB30b: EB CM* EM;
207
208# LB31 Break Everywhere Else.
209# Include combining marks
210LB31.1: . CM* ZJ (ID | EB | EM);
211LB31.2: . CM* ÷;