X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/249c4c5ea9376c24572daf9c2effa7484a282f14..3d1f044b704633e2e541231cd17ae9ecf9ad5c7a:/icuSources/data/brkitr/rules/line_loose_cj.txt diff --git a/icuSources/data/brkitr/rules/line_loose_cj.txt b/icuSources/data/brkitr/rules/line_loose_cj.txt index ff949be8..80d57c76 100644 --- a/icuSources/data/brkitr/rules/line_loose_cj.txt +++ b/icuSources/data/brkitr/rules/line_loose_cj.txt @@ -7,14 +7,11 @@ # # Line Breaking Rules # Implement default line breaking as defined by -# Unicode Standard Annex #14 Revision 40 for Unicode 11.0 -# http://www.unicode.org/reports/tr14/ +# Unicode Standard Annex #14 Revision 42 for Unicode 12.0 +# http://www.unicode.org/reports/tr14/, with the following modification: # -# tailored as noted in 2nd paragraph below. -# -# TODO: Rule LB 8 remains as it was in Unicode 5.2 -# This is only because of a limitation of ICU break engine implementation, -# not because the older behavior is desirable. +# Boundaries between hyphens and following letters are suppressed when +# there is a boundary preceding the hyphen. See rule 20.9 # # This tailors the line break behavior to correspond to CSS # line-break=loose (BCP47 -u-lb-loose) as defined for Chinese & Japanese. @@ -29,6 +26,7 @@ # this includes: 00B0 2030 2032 2033 2035 2103 2109 FE6A FF05 FFE0 # * after prefix characters with LineBreak class PR and EastAsianWidth A,F,W; # this includes: 00A4 00B1 20AC 2116 FE69 FF04 FFE1 FFE5 FFE6 +# It allows breaking before 201C and after 201D, for zh_Hans, zh_Hant, and ja. # @@ -42,16 +40,17 @@ $AI = [:LineBreak = Ambiguous:]; $AL = [:LineBreak = Alphabetic:]; $BAX = [\u2010 \u2013]; $BA = [[:LineBreak = Break_After:] - $BAX]; +$HH = [\u2010]; # \u2010 is HYPHEN, default line break is BA. $BB = [:LineBreak = Break_Before:]; $BK = [:LineBreak = Mandatory_Break:]; $B2 = [:LineBreak = Break_Both:]; $CB = [:LineBreak = Contingent_Break:]; $CJ = [:LineBreak = Conditional_Japanese_Starter:]; -$CL = [:LineBreak = Close_Punctuation:]; +$CL = [[:LineBreak = Close_Punctuation:] \u201d]; # $CM = [:LineBreak = Combining_Mark:]; $CP = [:LineBreak = Close_Parenthesis:]; $CR = [:LineBreak = Carriage_Return:]; -$EB = [[:LineBreak = EB:] \U0001F46A-\U0001F46D\U0001F46F\U0001F91D\U0001F93C]; +$EB = [:LineBreak = EB:]; $EM = [:LineBreak = EM:]; $EXX = [\uFF01 \uFF1F]; $EX = [[:LineBreak = Exclamation:] - $EXX]; @@ -72,12 +71,12 @@ $NL = [:LineBreak = Next_Line:]; $NSX = [\u301C \u30A0 \u3005 \u303B \u309D \u309E \u30FD \u30FE \u203C \u2047 \u2048 \u2049 \u30FB \uFF1A \uFF1B \uFF65]; $NS = [[:LineBreak = Nonstarter:] - $NSX]; $NU = [:LineBreak = Numeric:]; -$OP = [:LineBreak = Open_Punctuation:]; +$OP = [[:LineBreak = Open_Punctuation:] \u201c]; $POX = [\u00B0 \u2030 \u2032 \u2033 \u2035 \u2103 \u2109 \uFE6A \uFF05 \uFFE0]; $PO = [[:LineBreak = Postfix_Numeric:] - $POX]; $PRX = [\u00A4 \u00B1 \u20AC \u2116 \uFE69 \uFF04 \uFFE1 \uFFE5 \uFFE6]; $PR = [[:LineBreak = Prefix_Numeric:] - $PRX]; -$QU = [:LineBreak = Quotation:]; +$QU = [[:LineBreak = Quotation:] - [\u201c\u201d]]; $RI = [:LineBreak = Regional_Indicator:]; $SA = [:LineBreak = Complex_Context:]; $SG = [:LineBreak = Surrogate:]; @@ -93,6 +92,7 @@ $ZWJ = [:LineBreak = ZWJ:]; # By LB1, SA characters with general categor of Mn or Mc also resolve to CM. $CM = [[:LineBreak = Combining_Mark:] $ZWJ [$SA & [[:Mn:][:Mc:]]]]; +$CMX = [[$CM] - [$ZWJ]]; # Dictionary character set, for triggering language-based break engines. Currently # limited to LineBreak=Complex_Context (SA). @@ -151,12 +151,11 @@ $CAN_CM $CM* [$SP $ZW]; # # LB 8 Break after zero width space -# TODO: ZW SP* -# An engine change is required to write the reverse rule for this. -# For now, leave the Unicode 5.2 rule, ZW +# ZW SP* ÷ # $LB8Breaks = [$LB4Breaks $ZW]; $LB8NonBreaks = [[$LB4NonBreaks] - [$ZW]]; +$ZW $SP* / [^$SP $ZW $LB4Breaks]; # LB 8a ZWJ x Do not break Emoji ZWJ sequences. # @@ -192,8 +191,8 @@ $GL $CM* .; ^$CM+ $GL; -# -# LB 13 Don't break before ']' or '!' or ';' or '/', even after spaces. + +# LB 13 Don't break before ']' or '!' or or '/', even after spaces. # # Do not include $EXX here $LB8NonBreaks $CL; @@ -208,10 +207,6 @@ $LB8NonBreaks $EX; $CAN_CM $CM* $EX; ^$CM+ $EX; # by rule 10, stand-alone CM behaves as AL -$LB8NonBreaks $IS; -$CAN_CM $CM* $IS; -^$CM+ $IS; # by rule 10, stand-alone CM behaves as AL - $LB8NonBreaks $SY; $CAN_CM $CM* $SY; ^$CM+ $SY; # by rule 10, stand-alone CM behaves as AL @@ -219,12 +214,36 @@ $CAN_CM $CM* $SY; # # LB 14 Do not break after OP, even after spaces +# Note subtle interaction with "SP IS /" rules in LB14a. +# This rule consumes the SP, chaining happens on the IS, effectivley overriding the SP IS rules, +# which is the desired behavior. # $OP $CM* $SP* .; $OP $CM* $SP+ $CM+ $AL_FOLLOW?; # by rule 10, stand-alone CM behaves as AL # by rule 8, CM following a SP is stand-alone. + +# LB 14a Force a break before start of a number with a leading decimal pt, e.g. " .23" +# Note: would be simpler to express as "$SP / $IS $CM* $NU;", but ICU rules have limitations. +# See issue ICU-20303 + + +$CanFollowIS = [$BK $CR $LF $NL $SP $ZW $WJ $GL $CL $CP $EX $IS $SY $QU $BA $HY $NS $ALPlus $HL]; +$SP $IS / [^ $CanFollowIS $NU $CM]; +$SP $IS $CM* $CMX / [^ $CanFollowIS $NU $CM]; + +# +# LB 14b Do not break before numeric separators (IS), even after spaces. + +[$LB8NonBreaks - $SP] $IS; +$SP $IS $CM* [$CanFollowIS {eof}]; +$SP $IS $CM* $ZWJ [^$CM $NU]; + +$CAN_CM $CM* $IS; +^$CM+ $IS; # by rule 10, stand-alone CM behaves as AL + + # LB 15 $QU $CM* $SP* $OP; @@ -251,18 +270,25 @@ $LB18NonBreaks $CM* $QU; # QU x $QU $CM* .; - # LB 20 # $CB # $CB - +# $LB20NonBreaks = [$LB18NonBreaks - $CB]; +# LB 20.09 Don't break between Hyphens and Letters when there is a break preceding the hyphen. +# Originally added as a Finnish tailoring, now promoted to default ICU behavior. +# Note: this is not default UAX-14 behaviour. See issue ICU-8151. +# +^($HY | $HH) $CM* $ALPlus; + # LB 21 x (BA | HY | NS) # BB x # # DO allow breaks here before $BAX and $NSX, so don't include them $LB20NonBreaks $CM* ($BA | $HY | $NS); + + ^$CM+ ($BA | $HY | $NS); $BB $CM* [^$CB]; # $BB x @@ -311,7 +337,7 @@ $PR $CM* ($ID | $EB | $EM); # LB 25 Numbers. # # Here do not include $PRX at the beginning or $POX at the end -(($PR | $PO | $POX) $CM*)? (($OP | $HY) $CM*)? $NU ($CM* ($NU | $SY | $IS))* +(($PR | $PO | $POX) $CM*)? (($OP | $HY) $CM*)? ($IS $CM*)? $NU ($CM* ($NU | $SY | $IS))* ($CM* ($CL | $CP))? ($CM* ($PR | $PRX | $PO))?; # LB 26 Do not break a Korean syllable