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