scuffed-code/icu4c/source/data/brkitr/word_POSIX.txt

222 lines
5.0 KiB
Plaintext

#
# Copyright (C) 2002-2005, International Business Machines Corporation
# and others. All Rights Reserved.
#
# file: word.txt
#
# ICU Word Break Rules, POSIX locale.
# See Unicode Standard Annex #29.
# These rules are based on Unicode Version 4.1, with
# the modification that the ':' character is removed from the MidLetter category.
#
# Note: Updates to word.txt will usually need to be merged into
# word_POSIX.txt and word_ja.txt also.
##############################################################################
#
# Character class definitions from TR 29
#
##############################################################################
!!chain;
#
# Character Class Definitions.
#
$Format = [\p{Word_Break = Format}];
$Katakana = [\p{Word_Break = Katakana}];
$ALetter = [\p{Word_Break = ALetter}];
$MidLetter = [\p{Word_Break = MidLetter} - [ \:]];
$MidNum = [\p{Word_Break = MidNum}];
$Numeric = [\p{Word_Break = Numeric}];
$ExtendNumLet = [\p{Word_Break = ExtendNumLet}];
$CR = \u000d;
$LF = \u000a;
$Extend = [\p{Grapheme_Cluster_Break = Extend}];
$Control = [\p{Grapheme_Cluster_Break = Control}];
#
# Rules 3 Grapheme Clusters behave like their first char.
# Rule 4 Ignore trailing Format characters (Also see note in TR 29)
#
$KatakanaEx = $Katakana $Extend* $Format*;
$ALetterEx = $ALetter $Extend* $Format*;
$MidLetterEx = $MidLetter $Extend* $Format*;
$MidNumEx = $MidNum $Extend* $Format*;
$NumericEx = $Numeric $Extend* $Format*;
$ExtendNumLetEx = $ExtendNumLet $Extend* $Format*;
$Hiragana = [:Hiragana:];
$Ideographic = [:IDEOGRAPHIC:];
$HiraganaEx = $Hiragana $Extend* $Format*;
$IdeographicEx = $Ideographic $Extend* $Format*;
## -------------------------------------------------
!!forward;
# Rule 3 - don't break grapheme clusters.
# see character breaks.
$CR $LF $Format*;
[^$Control $CR $LF] $Extend+ $Format*;
[^$Control $CR $LF] $Extend* $Format+;
# Rule 4 - ignore trailing format characters
# For the most part, trailing formats are handled by the $<whatever>Ex
# definitions above. The rule here comes into play when the start of text
# begins with a group of Format chars, or with "word" consisting of a single
# char that is not in any of the listed word break categories followed by
# format char(s).
.? $Format+;
$NumericEx {100};
$ALetterEx {200};
$KatakanaEx {300};
$HiraganaEx {300};
$IdeographicEx {400};
# rule 5
$ALetterEx $ALetterEx {200};
# rule 6 and 7
$ALetterEx $MidLetterEx $ALetterEx {200};
# rule 8
$NumericEx $NumericEx {100};
# rule 9
$ALetterEx $Format* $NumericEx {200};
# rule 10
$NumericEx $ALetterEx {200};
# rule 11 and 12
$NumericEx $MidNumEx $NumericEx {100};
# rule 13
$KatakanaEx $KatakanaEx {300};
# rule 13a/b
$ALetterEx $ExtendNumLetEx {200}; # (13a)
$NumericEx $ExtendNumLetEx {100}; # (13a)
$KatakanaEx $ExtendNumLetEx {300}; # (13a)
$ExtendNumLetEx $ExtendNumLetEx{200}; # (13a)
$ExtendNumLetEx $ALetterEx {200}; # (13b)
$ExtendNumLetEx $NumericEx {100}; # (13b)
$ExtendNumLetEx $KatakanaEx {300}; # (13b)
## -------------------------------------------------
!!reverse;
$BackALetterEx = $Format* $Extend* $ALetter;
$BackNumericEx = $Format* $Extend* $Numeric;
$BackMidNumEx = $Format* $Extend* $MidNum;
$BackMidLetterEx = $Format* $Extend* $MidLetter;
$BackKatakanaEx = $Format* $Extend* $Katakana;
$BackExtendNumLetEx= $Format* $Extend* $ExtendNumLet;
$Format* $LF $CR;
# see character breaks
$Format* $Extend* [^$Control $CR $LF];
$Format+ .?;
# rule 5
$BackALetterEx $BackALetterEx;
# rule 6 and 7
$BackALetterEx $BackMidLetterEx $BackALetterEx;
# rule 8
$BackNumericEx $BackNumericEx;
# rule 9
$BackNumericEx $BackALetterEx;
# rule 10
$BackALetterEx $BackNumericEx;
# rule 11 and 12
$BackNumericEx $BackMidNumEx $BackNumericEx;
# rule 13
$BackKatakanaEx $BackKatakanaEx;
# rules 13 a/b
#
($BackALetterEx | $BackNumericEx | $BackKatakanaEx | $BackExtendNumLetEx) $BackExtendNumLetEx;
$BackExtendNumLetEx ($BackALetterEx | $BackNumericEx | $BackKatakanaEx);
## -------------------------------------------------
!!safe_reverse;
# rule 3
$Extend+ [^$Extend];
$Format+ $Extend* [^$Extend];
$Extend+; # comes into play when buffer _begins_ with an $Extend+.
$Format+;
# rule 6
$MidLetter $BackALetterEx;
# rule 11
$MidNum $BackNumericEx;
## -------------------------------------------------
!!safe_forward;
# rule 3
$Extend+ $Format*;
# rule 4
$Extend* $Format+ $ALetterEx;
$Extend* $Format+ $NumericEx;
$Extend* $Format+ $MidLetterEx;
$Extend* $Format+ $MidNumEx;
$Extend* $Format+ $KatakanaEx;
$Extend* $Format+ $ExtendNumLetEx;
$Extend+ $Format* $ALetterEx;
$Extend+ $Format* $NumericEx;
$Extend+ $Format* $MidLetterEx;
$Extend+ $Format* $MidNumEx;
$Extend+ $Format* $KatakanaEx;
$Extend+ $Format* $ExtendNumLetEx;
# rule 6
$MidLetterEx $ALetterEx;
# rule 11
$MidNumEx $NumericEx;