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