]> git.saurik.com Git - apple/icu.git/blame - icuSources/data/brkitr/rules/line_loose_fi.txt
ICU-62141.0.1.tar.gz
[apple/icu.git] / icuSources / data / brkitr / rules / line_loose_fi.txt
CommitLineData
0f5d89e8 1# Copyright (C) 2016 and later: Unicode, Inc. and others.
f3c0d7a5 2# License & terms of use: http://www.unicode.org/copyright.html
2ca993e8 3# Copyright (c) 2002-2016 International Business Machines Corporation and
08b89b0a
A
4# others. All Rights Reserved.
5#
6# file: line_loose_fi.txt
7#
8# Line Breaking Rules
2ca993e8 9# Implement default line breaking as defined by
0f5d89e8 10# Unicode Standard Annex #14 Revision 40 for Unicode 11.0
08b89b0a 11# http://www.unicode.org/reports/tr14/
f3c0d7a5 12# tailored as noted in 3rd paragraph below.
2ca993e8 13#
08b89b0a
A
14# TODO: Rule LB 8 remains as it was in Unicode 5.2
15# This is only because of a limitation of ICU break engine implementation,
16# not because the older behavior is desirable.
17#
18# This tailors the line break behavior both for Finnish and to correpond to CSS
f3c0d7a5 19# line-break=loose (BCP47 -u-lb-loose) as defined for languages other than
08b89b0a
A
20# Chinese & Japanese.
21# It sets characters of class CJ to behave like ID.
22# In addition, it allows breaks before 3005, 303B, 309D, 309E, 30FD, 30FE (all NS).
08b89b0a
A
23#
24# Character Classes defined by TR 14.
25#
26
27!!chain;
0f5d89e8 28!!quoted_literals_only;
08b89b0a 29
f3c0d7a5
A
30$AI = [:LineBreak = Ambiguous:];
31$AL = [:LineBreak = Alphabetic:];
32$BA = [:LineBreak = Break_After:];
33$HH = [\u2010]; # \u2010 is HYPHEN, default line break is BA.
08b89b0a
A
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:];
f3c0d7a5 40# $CM = [:LineBreak = Combining_Mark:];
08b89b0a
A
41$CP = [:LineBreak = Close_Parenthesis:];
42$CR = [:LineBreak = Carriage_Return:];
f3c0d7a5
A
43$EB = [[:LineBreak = EB:] \U0001F46A-\U0001F46D\U0001F46F\U0001F91D\U0001F93C];
44$EM = [:LineBreak = EM:];
08b89b0a
A
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:];
f3c0d7a5
A
51# CSS Loose tailoring: CJ resolves to ID
52$ID = [[:LineBreak = Ideographic:] $CJ];
08b89b0a
A
53$IN = [:LineBreak = Inseperable:];
54$IS = [:LineBreak = Infix_Numeric:];
55$JL = [:LineBreak = JL:];
56$JV = [:LineBreak = JV:];
57$JT = [:LineBreak = JT:];
58$LF = [:LineBreak = Line_Feed:];
59$NL = [:LineBreak = Next_Line:];
60$NSX = [\u3005 \u303B \u309D \u309E \u30FD \u30FE];
61$NS = [[:LineBreak = Nonstarter:] - $NSX];
62$NU = [:LineBreak = Numeric:];
63$OP = [:LineBreak = Open_Punctuation:];
64$PO = [:LineBreak = Postfix_Numeric:];
65$PR = [:LineBreak = Prefix_Numeric:];
66$QU = [:LineBreak = Quotation:];
67$RI = [:LineBreak = Regional_Indicator:];
68$SA = [:LineBreak = Complex_Context:];
69$SG = [:LineBreak = Surrogate:];
70$SP = [:LineBreak = Space:];
71$SY = [:LineBreak = Break_Symbols:];
72$WJ = [:LineBreak = Word_Joiner:];
73$XX = [:LineBreak = Unknown:];
74$ZW = [:LineBreak = ZWSpace:];
f3c0d7a5
A
75$ZWJ = [:LineBreak = ZWJ:];
76
f3c0d7a5
A
77# By LB9, a ZWJ also behaves as a CM. Including it in the definition of CM avoids having to explicitly
78# list it in the numerous rules that use CM.
79# By LB1, SA characters with general categor of Mn or Mc also resolve to CM.
80
81$CM = [[:LineBreak = Combining_Mark:] $ZWJ [$SA & [[:Mn:][:Mc:]]]];
08b89b0a
A
82
83# Dictionary character set, for triggering language-based break engines. Currently
f3c0d7a5 84# limited to LineBreak=Complex_Context (SA).
08b89b0a 85
f3c0d7a5 86$dictionary = [$SA];
08b89b0a
A
87
88#
89# Rule LB1. By default, treat AI (characters with ambiguous east Asian width),
f3c0d7a5 90# SA (Dictionary chars, excluding Mn and Mc)
08b89b0a
A
91# SG (Unpaired Surrogates)
92# XX (Unknown, unassigned)
93# as $AL (Alphabetic)
94#
f3c0d7a5
A
95$ALPlus = [$AL $AI $SG $XX [$SA-[[:Mn:][:Mc:]]]];
96
08b89b0a
A
97
98## -------------------------------------------------
99
08b89b0a
A
100#
101# CAN_CM is the set of characters that may combine with CM combining chars.
102# Note that Linebreak UAX 14's concept of a combining char and the rules
103# for what they can combine with are _very_ different from the rest of Unicode.
104#
105# Note that $CM itself is left out of this set. If CM is needed as a base
106# it must be listed separately in the rule.
107#
108$CAN_CM = [^$SP $BK $CR $LF $NL $ZW $CM]; # Bases that can take CMs
109$CANT_CM = [ $SP $BK $CR $LF $NL $ZW $CM]; # Bases that can't take CMs
110
111#
112# AL_FOLLOW set of chars that can unconditionally follow an AL
113# Needed in rules where stand-alone $CM s are treated as AL.
08b89b0a 114#
f3c0d7a5 115$AL_FOLLOW = [$BK $CR $LF $NL $ZW $SP $CL $CP $EX $HL $IS $SY $WJ $GL $OP $QU $BA $HH $HY $NS $IN $NU $PR $PO $ALPlus];
08b89b0a
A
116
117
118#
119# Rule LB 4, 5 Mandatory (Hard) breaks.
120#
121$LB4Breaks = [$BK $CR $LF $NL];
2ca993e8 122$LB4NonBreaks = [^$BK $CR $LF $NL $CM];
08b89b0a
A
123$CR $LF {100};
124
125#
126# LB 6 Do not break before hard line breaks.
127#
128$LB4NonBreaks? $LB4Breaks {100}; # LB 5 do not break before hard breaks.
129$CAN_CM $CM* $LB4Breaks {100};
2ca993e8 130^$CM+ $LB4Breaks {100};
08b89b0a
A
131
132# LB 7 x SP
133# x ZW
134$LB4NonBreaks [$SP $ZW];
135$CAN_CM $CM* [$SP $ZW];
2ca993e8 136^$CM+ [$SP $ZW];
08b89b0a
A
137
138#
139# LB 8 Break after zero width space
140# TODO: ZW SP* <break>
141# An engine change is required to write the reverse rule for this.
142# For now, leave the Unicode 5.2 rule, ZW <break>
143#
144$LB8Breaks = [$LB4Breaks $ZW];
145$LB8NonBreaks = [[$LB4NonBreaks] - [$ZW]];
146
0f5d89e8 147# LB 8a ZWJ x Do not break Emoji ZWJ sequences.
2ca993e8 148#
0f5d89e8 149$ZWJ [^$CM];
08b89b0a 150
2ca993e8
A
151# LB 9 Combining marks. X $CM needs to behave like X, where X is not $SP, $BK $CR $LF $NL
152# $CM not covered by the above needs to behave like $AL
08b89b0a
A
153# See definition of $CAN_CM.
154
155$CAN_CM $CM+; # Stick together any combining sequences that don't match other rules.
2ca993e8 156^$CM+;
08b89b0a
A
157
158#
159# LB 11 Do not break before or after WORD JOINER & related characters.
160#
f3c0d7a5
A
161$CAN_CM $CM* $WJ;
162$LB8NonBreaks $WJ;
163^$CM+ $WJ;
08b89b0a 164
f3c0d7a5 165$WJ $CM* .;
08b89b0a
A
166
167#
168# LB 12 Do not break after NBSP and related characters.
169# GL x
170#
f3c0d7a5 171$GL $CM* .;
2ca993e8 172
08b89b0a
A
173#
174# LB 12a Do not break before NBSP and related characters ...
175# [^SP BA HY] x GL
176#
f3c0d7a5
A
177[[$LB8NonBreaks] - [$SP $BA $HH $HY]] $CM* $GL;
178^$CM+ $GL;
08b89b0a
A
179
180
181
182#
183# LB 13 Don't break before ']' or '!' or ';' or '/', even after spaces.
184#
185$LB8NonBreaks $CL;
186$CAN_CM $CM* $CL;
2ca993e8 187^$CM+ $CL; # by rule 10, stand-alone CM behaves as AL
08b89b0a
A
188
189$LB8NonBreaks $CP;
190$CAN_CM $CM* $CP;
2ca993e8 191^$CM+ $CP; # by rule 10, stand-alone CM behaves as AL
08b89b0a
A
192
193$LB8NonBreaks $EX;
194$CAN_CM $CM* $EX;
2ca993e8 195^$CM+ $EX; # by rule 10, stand-alone CM behaves as AL
08b89b0a
A
196
197$LB8NonBreaks $IS;
198$CAN_CM $CM* $IS;
2ca993e8 199^$CM+ $IS; # by rule 10, stand-alone CM behaves as AL
08b89b0a
A
200
201$LB8NonBreaks $SY;
202$CAN_CM $CM* $SY;
2ca993e8 203^$CM+ $SY; # by rule 10, stand-alone CM behaves as AL
08b89b0a
A
204
205
206#
207# LB 14 Do not break after OP, even after spaces
208#
f3c0d7a5 209$OP $CM* $SP* .;
08b89b0a 210
f3c0d7a5
A
211$OP $CM* $SP+ $CM+ $AL_FOLLOW?; # by rule 10, stand-alone CM behaves as AL
212 # by rule 8, CM following a SP is stand-alone.
08b89b0a
A
213
214# LB 15
f3c0d7a5 215$QU $CM* $SP* $OP;
08b89b0a
A
216
217# LB 16
218# Do not break between closing punctuation and $NS, even with intervening spaces
219# But DO allow a break between closing punctuation and $NSX, don't include it here
f3c0d7a5 220($CL | $CP) $CM* $SP* $NS;
08b89b0a
A
221
222# LB 17
f3c0d7a5 223$B2 $CM* $SP* $B2;
08b89b0a
A
224
225#
226# LB 18 Break after spaces.
227#
228$LB18NonBreaks = [$LB8NonBreaks - [$SP]];
229$LB18Breaks = [$LB8Breaks $SP];
230
231
232# LB 19
233# x QU
f3c0d7a5
A
234$LB18NonBreaks $CM* $QU;
235^$CM+ $QU;
08b89b0a
A
236
237# QU x
f3c0d7a5
A
238$QU $CM* .;
239
08b89b0a
A
240
241# LB 20
242# <break> $CB
243# $CB <break>
244
245$LB20NonBreaks = [$LB18NonBreaks - $CB];
246
247# LB 20.09 added rule for Finnish tailoring
248# LB 21 x (BA | HY | NS)
249# BB x
250#
f3c0d7a5
A
251# DO allow breaks here before NSX, so don't include it
252$LB20NonBreaks $CM* ($BA | $HH | $HY | $NS) $CM* / $AL;
253$LB20NonBreaks $CM* ($BA | $HH | $HY | $NS);
08b89b0a 254($HY | $HH) $AL;
f3c0d7a5 255^$CM+ ($BA | $HY | $HH | $NS);
08b89b0a 256
f3c0d7a5
A
257$BB $CM* [^$CB]; # $BB x
258$BB $CM* $LB20NonBreaks;
08b89b0a
A
259
260# LB 21a Don't break after Hebrew + Hyphen
261# HL (HY | BA) x
2ca993e8 262#
f3c0d7a5 263$HL $CM* ($HY | $BA | $HH) $CM* [^$CB]?;
08b89b0a
A
264
265# LB 21b (forward) Don't break between SY and HL
266# (break between HL and SY already disallowed by LB 13 above)
f3c0d7a5 267$SY $CM* $HL;
08b89b0a
A
268
269# LB 22
f3c0d7a5
A
270($ALPlus | $HL) $CM* $IN;
271^$CM+ $IN; # by rule 10, any otherwise unattached CM behaves as AL
272$EX $CM* $IN;
273($ID | $EB | $EM) $CM* $IN;
274# $IN $CM* $IN; # delete this rule for CSS loose
275$NU $CM* $IN;
08b89b0a
A
276
277
278# $LB 23
f3c0d7a5
A
279#
280($ALPlus | $HL) $CM* $NU;
281^$CM+ $NU; # Rule 10, any otherwise unattached CM behaves as AL
282$NU $CM* ($ALPlus | $HL);
283
284# LB 23a
285#
286$PR $CM* ($ID | $EB | $EM);
287($ID | $EB | $EM) $CM* $PO;
288
08b89b0a
A
289
290#
291# LB 24
292#
f3c0d7a5
A
293($PR | $PO) $CM* ($ALPlus | $HL);
294($ALPlus | $HL) $CM* ($PR | $PO);
295^$CM+ ($PR | $PO); # Rule 10, any otherwise unattached CM behaves as AL
08b89b0a
A
296
297#
298# LB 25 Numbers.
299#
f3c0d7a5
A
300(($PR | $PO) $CM*)? (($OP | $HY) $CM*)? $NU ($CM* ($NU | $SY | $IS))*
301 ($CM* ($CL | $CP))? ($CM* ($PR | $PO))?;
08b89b0a
A
302
303# LB 26 Do not break a Korean syllable
304#
f3c0d7a5
A
305$JL $CM* ($JL | $JV | $H2 | $H3);
306($JV | $H2) $CM* ($JV | $JT);
307($JT | $H3) $CM* $JT;
08b89b0a
A
308
309# LB 27 Treat korean Syllable Block the same as ID (don't break it)
f3c0d7a5
A
310($JL | $JV | $JT | $H2 | $H3) $CM* $IN;
311($JL | $JV | $JT | $H2 | $H3) $CM* $PO;
312$PR $CM* ($JL | $JV | $JT | $H2 | $H3);
08b89b0a
A
313
314
315# LB 28 Do not break between alphabetics
316#
f3c0d7a5
A
317($ALPlus | $HL) $CM* ($ALPlus | $HL);
318^$CM+ ($ALPlus | $HL); # The $CM+ is from rule 10, an unattached CM is treated as AL
08b89b0a
A
319
320# LB 29
f3c0d7a5 321$IS $CM* ($ALPlus | $HL);
08b89b0a
A
322
323# LB 30
f3c0d7a5
A
324($ALPlus | $HL | $NU) $CM* $OP;
325^$CM+ $OP; # The $CM+ is from rule 10, an unattached CM is treated as AL.
326$CP $CM* ($ALPlus | $HL | $NU);
08b89b0a 327
2ca993e8 328# LB 30a Do not break between regional indicators. Break after pairs of them.
0f5d89e8
A
329# Tricky interaction with LB8a: ZWJ x . together with ZWJ acting like a CM.
330$RI $CM* $RI / [[^$BK $CR $LF $NL $SP $ZW $WJ $CL $CP $EX $IS $SY $GL $QU $BA $HY $NS $CM]];
331$RI $CM* $RI $CM* [$CM-$ZWJ] / [[^$BK $CR $LF $NL $SP $ZW $WJ $CL $CP $EX $IS $SY $GL $QU $BA $HY $NS $CM]];
332$RI $CM* $RI $CM* [$BK $CR $LF $NL $SP $ZW $WJ $CL $CP $EX $IS $SY $GL $QU $BA $HY $NS $ZWJ {eof}];
333# note: the preceding rule includes {eof} rather than having the last [set] term qualified with '?'
334# because of the chain-out behavior difference. The rule must chain out only from the [set characters],
335# not from the preceding $RI or $CM, which it would be able to do if the set were optional.
08b89b0a 336
2ca993e8
A
337# LB 30b Do not break between an Emoji Base and an Emoji Modifier
338$EB $CM* $EM;
08b89b0a 339
0f5d89e8
A
340# LB 31 Break everywhere else.
341# Match a single code point if no other rule applies.
342.;