]> git.saurik.com Git - apple/icu.git/blob - icuSources/data/brkitr/line_loose.txt
e2f0765127bc8f39ddc14e30b9f19d956d344631
[apple/icu.git] / icuSources / data / brkitr / line_loose.txt
1 # Copyright (c) 2002-2015 International Business Machines Corporation and
2 # others. All Rights Reserved.
3 #
4 # file: line_loose.txt
5 #
6 # Line Breaking Rules
7 # Implement default line breaking as defined by
8 # Unicode Standard Annex #14 Revision 29 for Unicode 6.2
9 # http://www.unicode.org/reports/tr14/
10 # tailored as noted in 2nd paragraph below..
11 #
12 # TODO: Rule LB 8 remains as it was in Unicode 5.2
13 # This is only because of a limitation of ICU break engine implementation,
14 # not because the older behavior is desirable.
15 #
16 # This tailors the line break behavior to correspond to CSS
17 # line-break=loose (BCP47 -u-lb-loose) as defined for languages other than
18 # Chinese & Japanese.
19 # It sets characters of class CJ to behave like ID.
20 # In addition, it allows breaks:
21 # * before iteration marks 3005, 303B, 309D, 309E, 30FD, 30FE (all NS)
22 # * between characters of LineBreak class IN
23
24 #
25 # Character Classes defined by TR 14.
26 #
27
28 !!chain;
29 !!LBCMNoChain;
30
31
32 !!lookAheadHardBreak;
33 #
34 # !!lookAheadHardBreak Described here because it is (as yet) undocumented elsewhere
35 # and only used for the line break rules.
36 #
37 # It is used in the implementation of rule LB 10
38 # which says to treat any combining mark that is not attached to a base
39 # character as if it were of class AL (alphabetic).
40 #
41 # The problem occurs in the reverse rules.
42 #
43 # Consider a sequence like, with correct breaks as shown
44 # LF ID CM AL AL
45 # ^ ^ ^
46 # Then consider the sequence without the initial ID (ideographic)
47 # LF CM AL AL
48 # ^ ^
49 # Our CM, which in the first example was attached to the ideograph,
50 # is now unattached, becomes an alpha, and joins in with the other
51 # alphas.
52 #
53 # When iterating forwards, these sequences do not present any problems
54 # When iterating backwards, we need to look ahead when encountering
55 # a CM to see whether it attaches to something further on or not.
56 # (Look-ahead in a reverse rule is looking towards the start)
57 #
58 # If the CM is unattached, we need to force a break.
59 #
60 # !!lookAheadHardBreak forces the run time state machine to
61 # stop immediately when a look ahead rule ( '/' operator) matches,
62 # and set the match position to that of the look-ahead operator,
63 # no matter what other rules may be in play at the time.
64 #
65 # See rule LB 19 for an example.
66 #
67
68 $AI = [:LineBreak = Ambiguous:];
69 $AL = [:LineBreak = Alphabetic:];
70 $BA = [:LineBreak = Break_After:];
71 $BB = [:LineBreak = Break_Before:];
72 $BK = [:LineBreak = Mandatory_Break:];
73 $B2 = [:LineBreak = Break_Both:];
74 $CB = [:LineBreak = Contingent_Break:];
75 $CJ = [:LineBreak = Conditional_Japanese_Starter:];
76 $CL = [:LineBreak = Close_Punctuation:];
77 $CM = [:LineBreak = Combining_Mark:];
78 $CP = [:LineBreak = Close_Parenthesis:];
79 $CR = [:LineBreak = Carriage_Return:];
80 $EX = [:LineBreak = Exclamation:];
81 $GL = [:LineBreak = Glue:];
82 $HL = [:LineBreak = Hebrew_Letter:];
83 $HY = [:LineBreak = Hyphen:];
84 $H2 = [:LineBreak = H2:];
85 $H3 = [:LineBreak = H3:];
86 $ID = [[:LineBreak = Ideographic:] $CJ];
87 $IN = [:LineBreak = Inseperable:];
88 $IS = [:LineBreak = Infix_Numeric:];
89 $JL = [:LineBreak = JL:];
90 $JV = [:LineBreak = JV:];
91 $JT = [:LineBreak = JT:];
92 $LF = [:LineBreak = Line_Feed:];
93 $NL = [:LineBreak = Next_Line:];
94 $NSX = [\u3005 \u303B \u309D \u309E \u30FD \u30FE];
95 $NS = [[:LineBreak = Nonstarter:] - $NSX];
96 $NU = [:LineBreak = Numeric:];
97 $OP = [:LineBreak = Open_Punctuation:];
98 $PO = [:LineBreak = Postfix_Numeric:];
99 $PR = [:LineBreak = Prefix_Numeric:];
100 $QU = [:LineBreak = Quotation:];
101 $RI = [:LineBreak = Regional_Indicator:];
102 $SA = [:LineBreak = Complex_Context:];
103 $SG = [:LineBreak = Surrogate:];
104 $SP = [:LineBreak = Space:];
105 $SY = [:LineBreak = Break_Symbols:];
106 $WJ = [:LineBreak = Word_Joiner:];
107 $XX = [:LineBreak = Unknown:];
108 $ZW = [:LineBreak = ZWSpace:];
109
110 # Special character classes for people & body part emoji:
111 # Subsets of $CM:
112 $ZWJ = \u200D;
113 $EmojiVar = \uFE0F;
114 # The following are subsets of $ID
115 $EmojiForSeqs = [\u2764 \U0001F466-\U0001F469 \U0001F48B];
116 $EmojiForMods = [\u261D \u270A-\u270C \U0001F385 \U0001F3C3-\U0001F3C4 \U0001F3C7 \U0001F3CA \U0001F442-\U0001F443 \U0001F446-\U0001F450 \U0001F466-\U0001F469 \U0001F46E-\U0001F478 \U0001F47C \U0001F481-\U0001F483 \U0001F485-\U0001F487 \U0001F4AA \U0001F596 \U0001F645-\U0001F647 \U0001F64B-\U0001F64F \U0001F6A3 \U0001F6B4-\U0001F6B6 \U0001F6C0];
117 $EmojiMods = [\U0001F3FB-\U0001F3FF];
118
119 # Dictionary character set, for triggering language-based break engines. Currently
120 # limited to LineBreak=Complex_Context. Note that this set only works in Unicode
121 # 5.0 or later as the definition of Complex_Context was corrected to include all
122 # characters requiring dictionary break.
123
124 $dictionary = [:LineBreak = Complex_Context:];
125
126 #
127 # Rule LB1. By default, treat AI (characters with ambiguous east Asian width),
128 # SA (South East Asian: Thai, Lao, Khmer)
129 # SG (Unpaired Surrogates)
130 # XX (Unknown, unassigned)
131 # as $AL (Alphabetic)
132 #
133 $ALPlus = [$AL $AI $SA $SG $XX];
134
135 #
136 # Combining Marks. X $CM* behaves as if it were X. Rule LB6.
137 #
138 $ALcm = $ALPlus $CM*;
139 $BAcm = $BA $CM*;
140 $BBcm = $BB $CM*;
141 $B2cm = $B2 $CM*;
142 $CLcm = $CL $CM*;
143 $CPcm = $CP $CM*;
144 $EXcm = $EX $CM*;
145 $GLcm = $GL $CM*;
146 $HLcm = $HL $CM*;
147 $HYcm = $HY $CM*;
148 $H2cm = $H2 $CM*;
149 $H3cm = $H3 $CM*;
150 $IDcm = $ID $CM*;
151 $INcm = $IN $CM*;
152 $IScm = $IS $CM*;
153 $JLcm = $JL $CM*;
154 $JVcm = $JV $CM*;
155 $JTcm = $JT $CM*;
156 $NScm = $NS $CM*;
157 $NSXcm = $NSX $CM*;
158 $NUcm = $NU $CM*;
159 $OPcm = $OP $CM*;
160 $POcm = $PO $CM*;
161 $PRcm = $PR $CM*;
162 $QUcm = $QU $CM*;
163 $RIcm = $RI $CM*;
164 $SYcm = $SY $CM*;
165 $WJcm = $WJ $CM*;
166
167 ## -------------------------------------------------
168
169 !!forward;
170
171 #
172 # Each class of character can stand by itself as an unbroken token, with trailing combining stuff
173 #
174 $ALPlus $CM+;
175 $BA $CM+;
176 $BB $CM+;
177 $B2 $CM+;
178 $CL $CM+;
179 $CP $CM+;
180 $EX $CM+;
181 $GL $CM+;
182 $HL $CM+;
183 $HY $CM+;
184 $H2 $CM+;
185 $H3 $CM+;
186 $ID $CM+;
187 $IN $CM+;
188 $IS $CM+;
189 $JL $CM+;
190 $JV $CM+;
191 $JT $CM+;
192 $NS $CM+;
193 $NSX $CM+;
194 $NU $CM+;
195 $OP $CM+;
196 $PO $CM+;
197 $PR $CM+;
198 $QU $CM+;
199 $RI $CM+;
200 $SY $CM+;
201 $WJ $CM+;
202
203 #
204 # CAN_CM is the set of characters that may combine with CM combining chars.
205 # Note that Linebreak UAX 14's concept of a combining char and the rules
206 # for what they can combine with are _very_ different from the rest of Unicode.
207 #
208 # Note that $CM itself is left out of this set. If CM is needed as a base
209 # it must be listed separately in the rule.
210 #
211 $CAN_CM = [^$SP $BK $CR $LF $NL $ZW $CM]; # Bases that can take CMs
212 $CANT_CM = [ $SP $BK $CR $LF $NL $ZW $CM]; # Bases that can't take CMs
213
214 #
215 # AL_FOLLOW set of chars that can unconditionally follow an AL
216 # Needed in rules where stand-alone $CM s are treated as AL.
217 # Chaining is disabled with CM because it causes other failures,
218 # so for this one case we need to manually list out longer sequences.
219 #
220 $AL_FOLLOW_NOCM = [$BK $CR $LF $NL $ZW $SP];
221 $AL_FOLLOW_CM = [$CL $CP $EX $HL $IS $SY $WJ $GL $OP $QU $BA $HY $NS $NSX $IN $NU $ALPlus];
222 $AL_FOLLOW = [$AL_FOLLOW_NOCM $AL_FOLLOW_CM];
223
224
225 #
226 # Rule LB 4, 5 Mandatory (Hard) breaks.
227 #
228 $LB4Breaks = [$BK $CR $LF $NL];
229 $LB4NonBreaks = [^$BK $CR $LF $NL];
230 $CR $LF {100};
231
232 #
233 # LB 6 Do not break before hard line breaks.
234 #
235 $LB4NonBreaks? $LB4Breaks {100}; # LB 5 do not break before hard breaks.
236 $CAN_CM $CM* $LB4Breaks {100};
237 $CM+ $LB4Breaks {100};
238
239 # LB 7 x SP
240 # x ZW
241 $LB4NonBreaks [$SP $ZW];
242 $CAN_CM $CM* [$SP $ZW];
243 $CM+ [$SP $ZW];
244
245 #
246 # LB 8 Break after zero width space
247 # TODO: ZW SP* <break>
248 # An engine change is required to write the reverse rule for this.
249 # For now, leave the Unicode 5.2 rule, ZW <break>
250 #
251 $LB8Breaks = [$LB4Breaks $ZW];
252 $LB8NonBreaks = [[$LB4NonBreaks] - [$ZW]];
253
254
255 # Special forward rule for people & body part emoji:
256 # don't break $ZWJ from subsequent $EmojiForSeqs
257 $EmojiForSeqs $EmojiVar? $EmojiMods? $ZWJ $EmojiForSeqs;
258
259 # LB 9 Combining marks. X $CM needs to behave like X, where X is not $SP, $BK $CR $LF $NL
260 # $CM not covered by the above needs to behave like $AL
261 # See definition of $CAN_CM.
262
263 $CAN_CM $CM+; # Stick together any combining sequences that don't match other rules.
264 $CM+;
265
266 #
267 # LB 11 Do not break before or after WORD JOINER & related characters.
268 #
269 $CAN_CM $CM* $WJcm;
270 $LB8NonBreaks $WJcm;
271 $CM+ $WJcm;
272
273 $WJcm $CANT_CM;
274 $WJcm $CAN_CM $CM*;
275
276 #
277 # LB 12 Do not break after NBSP and related characters.
278 # GL x
279 #
280 $GLcm $CAN_CM $CM*;
281 $GLcm $CANT_CM;
282
283 #
284 # LB 12a Do not break before NBSP and related characters ...
285 # [^SP BA HY] x GL
286 #
287 [[$LB8NonBreaks] - [$SP $BA $HY]] $CM* $GLcm;
288 $CM+ GLcm;
289
290
291
292 #
293 # LB 13 Don't break before ']' or '!' or ';' or '/', even after spaces.
294 #
295 $LB8NonBreaks $CL;
296 $CAN_CM $CM* $CL;
297 $CM+ $CL; # by rule 10, stand-alone CM behaves as AL
298
299 $LB8NonBreaks $CP;
300 $CAN_CM $CM* $CP;
301 $CM+ $CP; # by rule 10, stand-alone CM behaves as AL
302
303 $LB8NonBreaks $EX;
304 $CAN_CM $CM* $EX;
305 $CM+ $EX; # by rule 10, stand-alone CM behaves as AL
306
307 $LB8NonBreaks $IS;
308 $CAN_CM $CM* $IS;
309 $CM+ $IS; # by rule 10, stand-alone CM behaves as AL
310
311 $LB8NonBreaks $SY;
312 $CAN_CM $CM* $SY;
313 $CM+ $SY; # by rule 10, stand-alone CM behaves as AL
314
315
316 #
317 # LB 14 Do not break after OP, even after spaces
318 #
319 $OPcm $SP* $CAN_CM $CM*;
320 $OPcm $SP* $CANT_CM;
321
322 $OPcm $SP+ $CM+ $AL_FOLLOW?; # by rule 10, stand-alone CM behaves as AL
323
324 # LB 15
325 $QUcm $SP* $OPcm;
326
327 # LB 16
328 # Do not break between closing punctuation and $NS, even with intervening spaces
329 # But DO allow a break between closing punctuation and $NSX, don't include it here
330 ($CLcm | $CPcm) $SP* $NScm;
331
332 # LB 17
333 $B2cm $SP* $B2cm;
334
335 #
336 # LB 18 Break after spaces.
337 #
338 $LB18NonBreaks = [$LB8NonBreaks - [$SP]];
339 $LB18Breaks = [$LB8Breaks $SP];
340
341
342 # LB 19
343 # x QU
344 $LB18NonBreaks $CM* $QUcm;
345 $CM+ $QUcm;
346
347 # QU x
348 $QUcm .?;
349 $QUcm $LB18NonBreaks $CM*; # Don't let a combining mark go onto $CR, $BK, etc.
350 # TODO: I don't think this rule is needed.
351
352
353 # LB 20
354 # <break> $CB
355 # $CB <break>
356
357 $LB20NonBreaks = [$LB18NonBreaks - $CB];
358
359 # LB 21 x (BA | HY | NS)
360 # BB x
361 #
362 # DO allow breaks here before NSXcm, so don't include it
363 $LB20NonBreaks $CM* ($BAcm | $HYcm | $NScm);
364
365 $BBcm [^$CB]; # $BB x
366 $BBcm $LB20NonBreaks $CM*;
367
368 # LB 21a Don't break after Hebrew + Hyphen
369 # HL (HY | BA) x
370 #
371 $HLcm ($HYcm | $BAcm) [^$CB]?;
372
373 # LB 21b (forward) Don't break between SY and HL
374 # (break between HL and SY already disallowed by LB 13 above)
375 $SYcm $HLcm;
376
377 # LB 22
378 ($ALcm | $HLcm) $INcm;
379 $CM+ $INcm; # by rule 10, any otherwise unattached CM behaves as AL
380 $IDcm $INcm;
381 # $INcm $INcm; # delete this rule for CSS loose
382 $NUcm $INcm;
383
384
385 # $LB 23
386 $IDcm $POcm;
387 $ALcm $NUcm; # includes $LB19
388 $HLcm $NUcm;
389 $CM+ $NUcm; # Rule 10, any otherwise unattached CM behaves as AL
390 $NUcm $ALcm;
391 $NUcm $HLcm;
392
393 #
394 # LB 24
395 #
396 $PRcm $IDcm;
397 $PRcm ($ALcm | $HLcm);
398 $POcm ($ALcm | $HLcm);
399
400 #
401 # LB 25 Numbers.
402 #
403 ($PRcm | $POcm)? ($OPcm | $HYcm)? $NUcm ($NUcm | $SYcm | $IScm)* ($CLcm | $CPcm)? ($PRcm | $POcm)?;
404
405 # LB 26 Do not break a Korean syllable
406 #
407 $JLcm ($JLcm | $JVcm | $H2cm | $H3cm);
408 ($JVcm | $H2cm) ($JVcm | $JTcm);
409 ($JTcm | $H3cm) $JTcm;
410
411 # LB 27 Treat korean Syllable Block the same as ID (don't break it)
412 ($JLcm | $JVcm | $JTcm | $H2cm | $H3cm) $INcm;
413 ($JLcm | $JVcm | $JTcm | $H2cm | $H3cm) $POcm;
414 $PRcm ($JLcm | $JVcm | $JTcm | $H2cm | $H3cm);
415
416
417 # LB 28 Do not break between alphabetics
418 #
419 ($ALcm | $HLcm) ($ALcm | $HLcm);
420 $CM+ ($ALcm | $HLcm); # The $CM+ is from rule 10, an unattached CM is treated as AL
421
422 # LB 29
423 $IScm ($ALcm | $HLcm);
424
425 # LB 30
426 ($ALcm | $HLcm | $NUcm) $OPcm;
427 $CM+ $OPcm; # The $CM+ is from rule 10, an unattached CM is treated as AL.
428 $CPcm ($ALcm | $HLcm | $NUcm);
429
430 # LB 30a Do not break between regional indicators.
431 $RIcm $RIcm;
432
433 # Special forward rule for people & body part emoji:
434 # don't break between relevant emoji and $EmojiMods
435 $EmojiForMods $EmojiVar? $EmojiMods;
436
437 #
438 # Reverse Rules.
439 #
440 ## -------------------------------------------------
441
442 !!reverse;
443
444 $CM+ $ALPlus;
445 $CM+ $BA;
446 $CM+ $BB;
447 $CM+ $B2;
448 $CM+ $CL;
449 $CM+ $CP;
450 $CM+ $EX;
451 $CM+ $GL;
452 $CM+ $HL;
453 $CM+ $HY;
454 $CM+ $H2;
455 $CM+ $H3;
456 $CM+ $ID;
457 $CM+ $IN;
458 $CM+ $IS;
459 $CM+ $JL;
460 $CM+ $JV;
461 $CM+ $JT;
462 $CM+ $NS;
463 $CM+ $NSX;
464 $CM+ $NU;
465 $CM+ $OP;
466 $CM+ $PO;
467 $CM+ $PR;
468 $CM+ $QU;
469 $CM+ $RI;
470 $CM+ $SY;
471 $CM+ $WJ;
472 $CM+;
473
474
475 #
476 # Sequences of the form (shown forwards)
477 # [CANT_CM] <break> [CM] [whatever]
478 # The CM needs to behave as an AL
479 #
480 $AL_FOLLOW $CM+ / (
481 [$BK $CR $LF $NL $ZW {eof}] |
482 $SP+ $CM+ $SP |
483 $SP+ $CM* ([^$OP $CM $SP] | [$AL {eof}])); # if LB 14 will match, need to surpress this break.
484 # LB14 says OP SP* x .
485 # becomes OP SP* x AL
486 # becomes OP SP* x CM+ AL_FOLLOW
487 #
488 # Further note: the $AL in [$AL {eof}] is only to work around
489 # a rule compiler bug which complains about
490 # empty sets otherwise.
491
492 #
493 # Sequences of the form (shown forwards)
494 # [CANT_CM] <break> [CM] <break> [PR]
495 # The CM needs to behave as an AL
496 # This rule is concerned about getting the second of the two <breaks> in place.
497 #
498
499 [$PR ] / $CM+ [$BK $CR $LF $NL $ZW $SP {eof}];
500
501
502
503 # LB 4, 5, 5
504
505 $LB4Breaks [$LB4NonBreaks-$CM];
506 $LB4Breaks $CM+ $CAN_CM;
507 $LF $CR;
508
509
510 # LB 7 x SP
511 # x ZW
512 [$SP $ZW] [$LB4NonBreaks-$CM];
513 [$SP $ZW] $CM+ $CAN_CM;
514
515 # LB 8 ZW SP* <break>
516 # TODO: to implement this, we need more than one look-ahead hard break in play at a time.
517 # Requires an engine enhancement.
518 # / $SP* $ZW
519
520 # Special reverse rule for people & body part emoji:
521 # don't break $ZWJ from subsequent $EmojiForSeqs
522 $EmojiForSeqs $ZWJ $EmojiMods? $EmojiVar? $EmojiForSeqs;
523
524 # LB 9,10 Combining marks.
525 # X $CM needs to behave like X, where X is not $SP or controls.
526 # $CM not covered by the above needs to behave like $AL
527 # Stick together any combining sequences that don't match other rules.
528 $CM+ $CAN_CM;
529
530
531 # LB 11
532 $CM* $WJ $CM* $CAN_CM;
533 $CM* $WJ [$LB8NonBreaks-$CM];
534
535 $CANT_CM $CM* $WJ;
536 $CM* $CAN_CM $CM* $WJ;
537
538 # LB 12a
539 # [^SP BA HY] x GL
540 #
541 $CM* $GL $CM* [$LB8NonBreaks-[$CM $SP $BA $HY]];
542
543 # LB 12
544 # GL x
545 #
546 $CANT_CM $CM* $GL;
547 $CM* $CAN_CM $CM* $GL;
548
549
550 # LB 13
551 $CL $CM+ $CAN_CM;
552 $CP $CM+ $CAN_CM;
553 $EX $CM+ $CAN_CM;
554 $IS $CM+ $CAN_CM;
555 $SY $CM+ $CAN_CM;
556
557 $CL [$LB8NonBreaks-$CM];
558 $CP [$LB8NonBreaks-$CM];
559 $EX [$LB8NonBreaks-$CM];
560 $IS [$LB8NonBreaks-$CM];
561 $SY [$LB8NonBreaks-$CM];
562
563 # Rule 13 & 14 taken together for an edge case.
564 # Match this, shown forward
565 # OP SP+ ($CM+ behaving as $AL) (CL | CP | EX | IS | IY)
566 # This really wants to chain at the $CM+ (which is acting as an $AL)
567 # except for $CM chaining being disabled.
568 [$CL $CP $EX $IS $SY] $CM+ $SP+ $CM* $OP;
569
570 # LB 14 OP SP* x
571 #
572 $CM* $CAN_CM $SP* $CM* $OP;
573 $CANT_CM $SP* $CM* $OP;
574 $AL_FOLLOW? $CM+ $SP $SP* $CM* $OP; # by LB 10, behaves like $AL_FOLLOW? $AL $SP* $CM* $OP
575
576 $AL_FOLLOW_NOCM $CM+ $SP+ $CM* $OP;
577 $CM* $AL_FOLLOW_CM $CM+ $SP+ $CM* $OP;
578 $SY $CM $SP+ $OP; # TODO: Experiment. Remove.
579
580
581
582 # LB 15
583 $CM* $OP $SP* $CM* $QU;
584
585 # LB 16
586 # Don't include $NSX here
587 $CM* $NS $SP* $CM* ($CL | $CP);
588
589 # LB 17
590 $CM* $B2 $SP* $CM* $B2;
591
592 # LB 18 break after spaces
593 # Nothing explicit needed here.
594
595
596 #
597 # LB 19
598 #
599 $CM* $QU $CM* $CAN_CM; # . x QU
600 $CM* $QU $LB18NonBreaks;
601
602
603 $CM* $CAN_CM $CM* $QU; # QU x .
604 $CANT_CM $CM* $QU;
605
606 #
607 # LB 20 Break before and after CB.
608 # nothing needed here.
609 #
610
611 # LB 21
612 # Don't include $NSX here
613 $CM* ($BA | $HY | $NS) $CM* [$LB20NonBreaks-$CM]; # . x (BA | HY | NS)
614
615 $CM* [$LB20NonBreaks-$CM] $CM* $BB; # BB x .
616 [^$CB] $CM* $BB; #
617
618 # LB21a
619 [^$CB] $CM* ($HY | $BA) $CM* $HL;
620
621 # LB21b (reverse)
622 $CM* $HL $CM* $SY;
623
624 # LB 22
625 $CM* $IN $CM* ($ALPlus | $HL);
626 $CM* $IN $CM* $ID;
627 # $CM* $IN $CM* $IN; # delete this rule for CSS loose
628 $CM* $IN $CM* $NU;
629
630 # LB 23
631 $CM* $PO $CM* $ID;
632 $CM* $NU $CM* ($ALPlus | $HL);
633 $CM* ($ALPlus | $HL) $CM* $NU;
634
635 # LB 24
636 $CM* $ID $CM* $PR;
637 $CM* ($ALPlus | $HL) $CM* $PR;
638 $CM* ($ALPlus | $HL) $CM* $PO;
639
640
641 # LB 25
642 ($CM* ($PR | $PO))? ($CM* ($CL | $CP))? ($CM* ($NU | $IS | $SY))* $CM* $NU ($CM* ($OP | $HY))? ($CM* ($PR | $PO))?;
643
644 # LB 26
645 $CM* ($H3 | $H2 | $JV | $JL) $CM* $JL;
646 $CM* ($JT | $JV) $CM* ($H2 | $JV);
647 $CM* $JT $CM* ($H3 | $JT);
648
649 # LB 27
650 $CM* $IN $CM* ($H3 | $H2 | $JT | $JV | $JL);
651 $CM* $PO $CM* ($H3 | $H2 | $JT | $JV | $JL);
652 $CM* ($H3 | $H2 | $JT | $JV | $JL) $CM* $PR;
653
654 # LB 28
655 $CM* ($ALPlus | $HL) $CM* ($ALPlus | $HL);
656
657
658 # LB 29
659 $CM* ($ALPlus | $HL) $CM* $IS;
660
661 # LB 30
662 $CM* $OP $CM* ($ALPlus | $HL | $NU);
663 $CM* ($ALPlus | $HL | $NU) $CM* $CP;
664
665 # LB 30a
666 $CM* $RI $CM* $RI;
667
668 # Special reverse rule for people & body part emoji:
669 # don't break between relevant emoji and $EmojiMods
670 $EmojiMods $EmojiVar? $EmojiForMods;
671
672 ## -------------------------------------------------
673
674 !!safe_reverse;
675
676 # LB 9
677 $CM+ [^$CM $BK $CR $LF $NL $ZW $SP];
678 $CM+ $SP / .;
679
680 # LB 14
681 $SP+ $CM* $OP;
682
683 # LB 15
684 $SP+ $CM* $QU;
685
686 # LB 16
687 $SP+ $CM* ($CL | $CP);
688
689 # LB 17
690 $SP+ $CM* $B2;
691
692 # LB 21
693 $CM* ($HY | $BA) $CM* $HL;
694
695 # LB 25
696 ($CM* ($IS | $SY))+ $CM* $NU;
697 ($CL | $CP) $CM* ($NU | $IS | $SY);
698
699 # For dictionary-based break
700 $dictionary $dictionary;
701
702 ## -------------------------------------------------
703
704 !!safe_forward;
705
706 # Skip forward over all character classes that are involved in
707 # rules containing patterns with possibly more than one char
708 # of context.
709 #
710 # It might be slightly more efficient to have specific rules
711 # instead of one generic one, but only if we could
712 # turn off rule chaining. We don't want to move more
713 # than necessary.
714 #
715 [$CM $OP $QU $CL $CP $B2 $PR $HY $BA $SP $dictionary]+ [^$CM $OP $QU $CL $CP $B2 $PR $HY $BA $dictionary];
716 $dictionary $dictionary;
717