scuffed-code/icu4c/source/data/brkitr/line.txt
2003-10-11 00:44:36 +00:00

169 lines
3.9 KiB
Plaintext

# Copyright (c) 2002-2003 International Business Machines Corporation and
# others. All Rights Reserved.
#
# file: line.txt
#
# Line Breaking Rules
# Implement default line breaking as defined by Unicode TR 14.
#
#
# Character Classes defined by TR 14.
#
!!chain
$AI = [:LineBreak = Ambiguous:];
$AL = [:LineBreak = Alphabetic:];
$BA = [:LineBreak = Break_After:];
$BB = [:LineBreak = Break_Before:];
$BK = [:LineBreak = Mandatory_Break:];
$B2 = [:LineBreak = Break_Both:];
$CB = [:LineBreak = Contingent_Break:];
$CL = [:LineBreak = Close_Punctuation:];
$CM = [:LineBreak = Combining_Mark:];
$CR = [:LineBreak = Carriage_Return:];
$EX = [:LineBreak = Exclamation:];
$GL = [:LineBreak = Glue:];
$HY = [:LineBreak = Hyphen:];
$ID = [:LineBreak = Ideographic:];
$IN = [:LineBreak = Inseperable:];
$IS = [:LineBreak = Infix_Numeric:];
$LF = [:LineBreak = Line_Feed:];
$NL = [:LineBreak = Next_Line:];
$NS = [:LineBreak = Nonstarter:];
$NU = [:LineBreak = Numeric:];
$OP = [:LineBreak = Open_Punctuation:];
$PO = [:LineBreak = Postfix_Numeric:];
$PR = [:LineBreak = Prefix_Numeric:];
$QU = [:LineBreak = Quotation:];
$SA = [:LineBreak = Complex_Context:];
$SG = [:LineBreak = Surrogate:];
$SP = [:LineBreak = Space:];
$SY = [:LineBreak = Break_Symbols:];
$XX = [:LineBreak = Unknown:];
$ZW = [:LineBreak = ZWSpace:];
#
# Rule LB1. By default, treat AI (characters with ambiguous east Asian width),
# SA (South East Asian: Thai, Lao, Khmer)
# XX (Unknown, unassigned)
# as $AL (Alphabetic)
#
$ALPlus = $AL | $AI | $SA | $XX;
#
# Combining Marks. X $CM* behaves as if it were X. Rule LB6.
#
$ALcm = $ALPlus $CM*;
$BAcm = $BA $CM*;
$BBcm = $BB $CM*;
$B2cm = $B2 $CM*;
$CLcm = $CL $CM*;
$EXcm = $EX $CM*;
$GLcm = $GL $CM*;
$HYcm = $HY $CM*;
$IDcm = $ID $CM*;
$INcm = $IN $CM*;
$IScm = $IS $CM*;
$NScm = $NS $CM*;
$NUcm = $NU $CM*;
$OPcm = $OP $CM*;
$POcm = $PO $CM*;
$PRcm = $PR $CM*;
$QUcm = $QU $CM*;
$SPcm = $SP $CM*;
$SYcm = $SY $CM*;
#
# Rule LB 3
$LB3NonBreaks = [^$BK $CR $LF $NL];
$LB3NonBreaks? ($BK | $CR | $LF | $NL){100};
$CR $LF {100};
# LB 4 x SP
# x ZW
$LB3NonBreaks [$SP $ZW];
# LB 5 Break after zero width space
$LB5NonBreaks = [[$LB3NonBreaks] - [$ZW]];
# LB 7 Combining marks. TODO: get it right!
# $SP $CM needs to behave like $ID.
# X $CM needs to behave like X, where X is not $SP.
# $CM not covered by the above needs to behave like $AL
[$LB5NonBreaks] $CM+; # Stick together any combining sequences that don't match other rules.
# LB 8
[$LB5NonBreaks] $CL;
[$LB5NonBreaks] $EX;
[$LB5NonBreaks] $IS;
[$LB5NonBreaks] $SY;
# LB 9
$OPcm $SP* .?;
$OPcm $SP* [$LB5NonBreaks] $CM*;
# LB 10
$QUcm $SP* $OPcm;
# LB 11
$CLcm $SP* $NScm;
# LB 11a
($B2cm)+;
# LB 11b
$LB5NonBreaks $GLcm .?;
$LB5NonBreaks $GLcm [$LB5NonBreaks] $CM*;
$GLcm $LB3NonBreaks?;
$GLcm [$LB5NonBreaks] $CM*;
# LB 12
$LB12NonBreaks = [[$LB5NonBreaks] - [$SP]];
# LB 14
$LB12NonBreaks $QUcm+ .?;
$LB12NonBreaks $QUcm+ [$LB5NonBreaks] $CM*;
$QUcm $LB3NonBreaks?;
$QUcm [$LB5NonBreaks] $CM*; # Don't let a combining mark go onto $CR, $BK, etc.
# LB 14a
$LB14NonBreaks = [[$LB12NonBreaks] - [$CB]];
# LB 15
$LB14NonBreaks ($BAcm | $HYcm | $NScm);
$BBcm [^$CB];
# LB 16
($ALcm | $IDcm | $SP $CM+ | $INcm | $NUcm) $INcm;
# $LB 17
($IDcm | SP CM+) $POcm;
$ALcm+ $NUcm; # includes $LB19
$NUcm $ALcm+;
# LB 18
$PRcm? ($OPcm | $HYcm)? $NUcm ($NUcm | $IScm)* $CLcm? $POcm?;
#$PRcm? ($OPcm | $HYcm)? $NUcm ($NUcm | $IScm)* $CLcm?;
# LB 19
#$CM* $ALcm+;
$ALcm+;
#
# Reverse Rules.
#
# Back up to a hard break or a space that will cause a boundary.
# Not all spaces cause line breaks. $SpaceGlue represents a sequence
# containing a space that may inhibit a break from occuring.
#
!.*;