OLD | NEW |
1 # Copyright (c) 2002-2013 International Business Machines Corporation and | 1 # Copyright (c) 2002-2015 International Business Machines Corporation and |
2 # others. All Rights Reserved. | 2 # others. All Rights Reserved. |
3 # | 3 # |
4 # file: line.txt | 4 # file: line.txt |
5 # | 5 # |
6 # Line Breaking Rules | 6 # Line Breaking Rules |
7 # Implement default line breaking as defined by | 7 # Implement default line breaking as defined by |
8 # Unicode Standard Annex #14 Revision 29 for Unicode 6.2 | 8 # Unicode Standard Annex #14 Revision 34 for Unicode 8.0 |
9 # http://www.unicode.org/reports/tr14/ | 9 # http://www.unicode.org/reports/tr14/ |
10 # | 10 # |
11 # TODO: Rule LB 8 remains as it was in Unicode 5.2 | 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 implementatio
n, | 12 # This is only because of a limitation of ICU break engine implementatio
n, |
13 # not because the older behavior is desirable. | 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. |
14 | 17 |
15 # CHROME: 1. Use line_ja.txt to apply small kana rules in all locales. | 18 # |
16 # 2. Adjust CL, OP, and IS to handle 'comma-variants' consistently. | 19 # Character Classes defined by TR 14. |
| 20 # |
17 | 21 |
18 !!chain; | 22 !!chain; |
19 !!LBCMNoChain; | 23 !!LBCMNoChain; |
20 | 24 |
21 | 25 |
22 !!lookAheadHardBreak; | 26 !!lookAheadHardBreak; |
23 # | 27 # |
24 # !!lookAheadHardBreak Described here because it is (as yet) undocumented el
sewhere | 28 # !!lookAheadHardBreak Described here because it is (as yet) undocumented el
sewhere |
25 # and only used for the line break rules. | 29 # and only used for the line break rules. |
26 # | 30 # |
(...skipping 22 matching lines...) Expand all Loading... |
49 # | 53 # |
50 # !!lookAheadHardBreak forces the run time state machine to | 54 # !!lookAheadHardBreak forces the run time state machine to |
51 # stop immediately when a look ahead rule ( '/' operator) matches, | 55 # stop immediately when a look ahead rule ( '/' operator) matches, |
52 # and set the match position to that of the look-ahead operator, | 56 # and set the match position to that of the look-ahead operator, |
53 # no matter what other rules may be in play at the time. | 57 # no matter what other rules may be in play at the time. |
54 # | 58 # |
55 # See rule LB 19 for an example. | 59 # See rule LB 19 for an example. |
56 # | 60 # |
57 | 61 |
58 $AI = [:LineBreak = Ambiguous:]; | 62 $AI = [:LineBreak = Ambiguous:]; |
59 $AL = [[:LineBreak = Alphabetic:] - [\u23B4\u23B5]]; | 63 $AL = [:LineBreak = Alphabetic:]; |
60 $BA = [:LineBreak = Break_After:]; | 64 $BA = [:LineBreak = Break_After:]; |
61 $BB = [:LineBreak = Break_Before:]; | 65 $BB = [:LineBreak = Break_Before:]; |
62 $BK = [:LineBreak = Mandatory_Break:]; | 66 $BK = [:LineBreak = Mandatory_Break:]; |
63 $B2 = [:LineBreak = Break_Both:]; | 67 $B2 = [:LineBreak = Break_Both:]; |
64 $CB = [:LineBreak = Contingent_Break:]; | 68 $CB = [:LineBreak = Contingent_Break:]; |
65 $CJ = [:LineBreak = Conditional_Japanese_Starter:]; | 69 $CJ = [:LineBreak = Conditional_Japanese_Starter:]; |
66 $CL = [[:LineBreak = Close_Punctuation:] [\uFE51\uFE10\u23B5]]; | 70 $CL = [:LineBreak = Close_Punctuation:]; |
67 $CM = [:LineBreak = Combining_Mark:]; | 71 $CM = [:LineBreak = Combining_Mark:]; |
68 $CP = [:LineBreak = Close_Parenthesis:]; | 72 $CP = [:LineBreak = Close_Parenthesis:]; |
69 $CR = [:LineBreak = Carriage_Return:]; | 73 $CR = [:LineBreak = Carriage_Return:]; |
70 $EX = [:LineBreak = Exclamation:]; | 74 $EX = [:LineBreak = Exclamation:]; |
71 $GL = [:LineBreak = Glue:]; | 75 $GL = [:LineBreak = Glue:]; |
72 $HL = [:LineBreak = Hebrew_Letter:]; | 76 $HL = [:LineBreak = Hebrew_Letter:]; |
73 $HY = [:LineBreak = Hyphen:]; | 77 $HY = [:LineBreak = Hyphen:]; |
74 $H2 = [:LineBreak = H2:]; | 78 $H2 = [:LineBreak = H2:]; |
75 $H3 = [:LineBreak = H3:]; | 79 $H3 = [:LineBreak = H3:]; |
76 $ID = [[[:LineBreak = Ideographic:] $CJ] - [\uFE51]]; | 80 $ID = [:LineBreak = Ideographic:]; |
77 $IN = [:LineBreak = Inseperable:]; | 81 $IN = [:LineBreak = Inseperable:]; |
78 $IS = [[:LineBreak = Infix_Numeric:] - [\uFE10]]; | 82 $IS = [:LineBreak = Infix_Numeric:]; |
79 $JL = [:LineBreak = JL:]; | 83 $JL = [:LineBreak = JL:]; |
80 $JV = [:LineBreak = JV:]; | 84 $JV = [:LineBreak = JV:]; |
81 $JT = [:LineBreak = JT:]; | 85 $JT = [:LineBreak = JT:]; |
82 $LF = [:LineBreak = Line_Feed:]; | 86 $LF = [:LineBreak = Line_Feed:]; |
83 $NL = [:LineBreak = Next_Line:]; | 87 $NL = [:LineBreak = Next_Line:]; |
84 $NS = [:LineBreak = Nonstarter:]; | 88 $NS = [[:LineBreak = Nonstarter:] $CJ]; |
85 $NU = [:LineBreak = Numeric:]; | 89 $NU = [:LineBreak = Numeric:]; |
86 $OP = [[:LineBreak = Open_Punctuation:] \u23B4]; | 90 $OP = [:LineBreak = Open_Punctuation:]; |
87 $PO = [:LineBreak = Postfix_Numeric:]; | 91 $PO = [:LineBreak = Postfix_Numeric:]; |
88 $PR = [:LineBreak = Prefix_Numeric:]; | 92 $PR = [:LineBreak = Prefix_Numeric:]; |
89 $QU = [:LineBreak = Quotation:]; | 93 $QU = [:LineBreak = Quotation:]; |
90 $RI = [:LineBreak = Regional_Indicator:]; | 94 $RI = [:LineBreak = Regional_Indicator:]; |
91 $SA = [:LineBreak = Complex_Context:]; | 95 $SA = [:LineBreak = Complex_Context:]; |
92 $SG = [:LineBreak = Surrogate:]; | 96 $SG = [:LineBreak = Surrogate:]; |
93 $SP = [:LineBreak = Space:]; | 97 $SP = [:LineBreak = Space:]; |
94 $SY = [:LineBreak = Break_Symbols:]; | 98 $SY = [:LineBreak = Break_Symbols:]; |
95 $WJ = [:LineBreak = Word_Joiner:]; | 99 $WJ = [:LineBreak = Word_Joiner:]; |
96 $XX = [:LineBreak = Unknown:]; | 100 $XX = [:LineBreak = Unknown:]; |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 # | 345 # |
342 $HLcm ($HYcm | $BAcm) [^$CB]?; | 346 $HLcm ($HYcm | $BAcm) [^$CB]?; |
343 | 347 |
344 # LB 21b (forward) Don't break between SY and HL | 348 # LB 21b (forward) Don't break between SY and HL |
345 # (break between HL and SY already disallowed by LB 13 above) | 349 # (break between HL and SY already disallowed by LB 13 above) |
346 $SYcm $HLcm; | 350 $SYcm $HLcm; |
347 | 351 |
348 # LB 22 | 352 # LB 22 |
349 ($ALcm | $HLcm) $INcm; | 353 ($ALcm | $HLcm) $INcm; |
350 $CM+ $INcm; # by rule 10, any otherwise unattached CM behaves as AL | 354 $CM+ $INcm; # by rule 10, any otherwise unattached CM behaves as AL |
| 355 $EXcm $INcm; |
351 $IDcm $INcm; | 356 $IDcm $INcm; |
352 $INcm $INcm; | 357 $INcm $INcm; |
353 $NUcm $INcm; | 358 $NUcm $INcm; |
354 | 359 |
355 | 360 |
356 # $LB 23 | 361 # $LB 23 |
357 $IDcm $POcm; | 362 $IDcm $POcm; |
358 $ALcm $NUcm; # includes $LB19 | 363 $ALcm $NUcm; # includes $LB19 |
359 $HLcm $NUcm; | 364 $HLcm $NUcm; |
360 $CM+ $NUcm; # Rule 10, any otherwise unattached CM behaves as AL | 365 $CM+ $NUcm; # Rule 10, any otherwise unattached CM behaves as AL |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 [^$CB] $CM* $BB; # | 581 [^$CB] $CM* $BB; # |
577 | 582 |
578 # LB21a | 583 # LB21a |
579 [^$CB] $CM* ($HY | $BA) $CM* $HL; | 584 [^$CB] $CM* ($HY | $BA) $CM* $HL; |
580 | 585 |
581 # LB21b (reverse) | 586 # LB21b (reverse) |
582 $CM* $HL $CM* $SY; | 587 $CM* $HL $CM* $SY; |
583 | 588 |
584 # LB 22 | 589 # LB 22 |
585 $CM* $IN $CM* ($ALPlus | $HL); | 590 $CM* $IN $CM* ($ALPlus | $HL); |
| 591 $CM* $IN $CM* $EX; |
586 $CM* $IN $CM* $ID; | 592 $CM* $IN $CM* $ID; |
587 $CM* $IN $CM* $IN; | 593 $CM* $IN $CM* $IN; |
588 $CM* $IN $CM* $NU; | 594 $CM* $IN $CM* $NU; |
589 | 595 |
590 # LB 23 | 596 # LB 23 |
591 $CM* $PO $CM* $ID; | 597 $CM* $PO $CM* $ID; |
592 $CM* $NU $CM* ($ALPlus | $HL); | 598 $CM* $NU $CM* ($ALPlus | $HL); |
593 $CM* ($ALPlus | $HL) $CM* $NU; | 599 $CM* ($ALPlus | $HL) $CM* $NU; |
594 | 600 |
595 # LB 24 | 601 # LB 24 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 # of context. | 670 # of context. |
665 # | 671 # |
666 # It might be slightly more efficient to have specific rules | 672 # It might be slightly more efficient to have specific rules |
667 # instead of one generic one, but only if we could | 673 # instead of one generic one, but only if we could |
668 # turn off rule chaining. We don't want to move more | 674 # turn off rule chaining. We don't want to move more |
669 # than necessary. | 675 # than necessary. |
670 # | 676 # |
671 [$CM $OP $QU $CL $CP $B2 $PR $HY $BA $SP $dictionary]+ [^$CM $OP $QU $CL $CP $B2
$PR $HY $BA $dictionary]; | 677 [$CM $OP $QU $CL $CP $B2 $PR $HY $BA $SP $dictionary]+ [^$CM $OP $QU $CL $CP $B2
$PR $HY $BA $dictionary]; |
672 $dictionary $dictionary; | 678 $dictionary $dictionary; |
673 | 679 |
OLD | NEW |