2 # Copyright (C) 2002-2006, International Business Machines Corporation
3 # and others. All Rights Reserved.
7 # ICU Word Break Rules, POSIX locale.
8 # See Unicode Standard Annex #29.
9 # These rules are based on Unicode Version 5.0 0
10 # Includes post Unicode 5.0 change to treat Japanese half width voicing marks
13 # Note: Updates to word.txt will usually need to be merged into
14 # word_POSIX.txt and word_ja.txt also.
16 ##############################################################################
18 # Character class definitions from TR 29
20 ##############################################################################
26 # Character Class Definitions.
29 $VoiceMarks = [\uff9e\uff9f];
30 $Format = [\p{Word_Break = Format}];
31 $Katakana = [\p{Word_Break = Katakana}-$VoiceMarks];
32 $ALetter = [\p{Word_Break = ALetter}];
33 $MidLetter = [\p{Word_Break = MidLetter} - [ \:]];
34 $MidNum = [\p{Word_Break = MidNum}];
35 $Numeric = [\p{Word_Break = Numeric}];
36 $ExtendNumLet = [\p{Word_Break = ExtendNumLet}];
41 $Extend = [\p{Grapheme_Cluster_Break = Extend}$VoiceMarks];
42 $Control = [\p{Grapheme_Cluster_Break = Control}];
44 # Dictionary character set, for triggering language-based break engines. Currently
45 # limited to LineBreak=Complex_Context. Note that this set only works in Unicode
46 # 5.0 or later as the definition of Complex_Context was corrected to include all
47 # characters requiring dictionary break.
49 $dictionary = [:LineBreak = Complex_Context:];
50 $ALetterPlus = [$ALetter [$dictionary-$Extend-$Control]];
54 # Rules 3 Grapheme Clusters behave like their first char.
55 # Rule 4 Ignore trailing Format characters (Also see note in TR 29)
57 $KatakanaEx = $Katakana ($Extend | $Format)*;
58 $ALetterEx = $ALetterPlus ($Extend | $Format)*;
59 $MidLetterEx = $MidLetter ($Extend | $Format)*;
60 $MidNumEx = $MidNum ($Extend | $Format)*;
61 $NumericEx = $Numeric ($Extend | $Format)*;
62 $ExtendNumLetEx = $ExtendNumLet ($Extend | $Format)*;
64 $Hiragana = [:Hiragana:];
65 $Ideographic = [:IDEOGRAPHIC:];
66 $HiraganaEx = $Hiragana ($Extend | $Format)*;
67 $IdeographicEx = $Ideographic ($Extend | $Format)*;
69 ## -------------------------------------------------
75 # see character breaks.
77 $CR $LF ($Extend | $Format)*;
79 # Rule 4 - ignore Format and Extend characters, except when they appear at the beginning
80 # of a region of Text. The rule here comes into play when the start of text
81 # begins with a group of Format chars, or with a "word" consisting of a single
82 # char that is not in any of the listed word break categories followed by
84 .? ($Extend | $Format)+;
95 $ALetterEx $ALetterEx {200};
98 $ALetterEx $MidLetterEx $ALetterEx {200};
102 $NumericEx $NumericEx {100};
106 $ALetterEx $Format* $NumericEx {200};
110 $NumericEx $ALetterEx {200};
114 $NumericEx $MidNumEx $NumericEx {100};
118 $KatakanaEx $KatakanaEx {300};
122 $ALetterEx $ExtendNumLetEx {200}; # (13a)
123 $NumericEx $ExtendNumLetEx {100}; # (13a)
124 $KatakanaEx $ExtendNumLetEx {300}; # (13a)
125 $ExtendNumLetEx $ExtendNumLetEx{200}; # (13a)
127 $ExtendNumLetEx $ALetterEx {200}; # (13b)
128 $ExtendNumLetEx $NumericEx {100}; # (13b)
129 $ExtendNumLetEx $KatakanaEx {300}; # (13b)
133 ## -------------------------------------------------
137 $BackALetterEx = ($Format | $Extend)* $ALetterPlus;
138 $BackNumericEx = ($Format | $Extend)* $Numeric;
139 $BackMidNumEx = ($Format | $Extend)* $MidNum;
140 $BackMidLetterEx = ($Format | $Extend)* $MidLetter;
141 $BackKatakanaEx = ($Format | $Extend)* $Katakana;
142 $BackExtendNumLetEx= ($Format | $Extend)* $ExtendNumLet;
145 ($Format | $Extend)* $LF $CR;
148 ($Format | $Extend)* .?;
152 $BackALetterEx $BackALetterEx;
156 $BackALetterEx $BackMidLetterEx $BackALetterEx;
161 $BackNumericEx $BackNumericEx;
165 $BackNumericEx $BackALetterEx;
169 $BackALetterEx $BackNumericEx;
173 $BackNumericEx $BackMidNumEx $BackNumericEx;
177 $BackKatakanaEx $BackKatakanaEx;
181 ($BackALetterEx | $BackNumericEx | $BackKatakanaEx | $BackExtendNumLetEx) $BackExtendNumLetEx;
182 $BackExtendNumLetEx ($BackALetterEx | $BackNumericEx | $BackKatakanaEx);
184 ## -------------------------------------------------
189 ($Extend | $Format)+ .?;
192 $MidLetter $BackALetterEx;
195 $MidNum $BackNumericEx;
197 # For dictionary-based break
198 $dictionary $dictionary;
200 ## -------------------------------------------------
205 ($Extend | $Format)+ .?;
208 $MidLetterEx $ALetterEx;
211 $MidNumEx $NumericEx;
213 # For dictionary-based break
214 $dictionary $dictionary;