]>
Commit | Line | Data |
---|---|---|
0f5d89e8 | 1 | # |
f3c0d7a5 A |
2 | # Copyright (C) 2016 and later: Unicode, Inc. and others. |
3 | # License & terms of use: http://www.unicode.org/copyright.html | |
2ca993e8 A |
4 | # Copyright (C) 2002-2016, International Business Machines Corporation and others. |
5 | # All Rights Reserved. | |
6 | # | |
7 | # file: char.txt | |
8 | # | |
3d1f044b A |
9 | # ICU Character Break Rules |
10 | # These rules are based on the Extended Grapheme Cluster rules from | |
11 | # Unicode UAX #29 Revision 34 for Unicode Version 12.0 | |
2ca993e8 | 12 | |
0f5d89e8 A |
13 | !!quoted_literals_only; |
14 | ||
2ca993e8 A |
15 | # |
16 | # Character Class Definitions. | |
17 | # | |
18 | $CR = [\p{Grapheme_Cluster_Break = CR}]; | |
19 | $LF = [\p{Grapheme_Cluster_Break = LF}]; | |
f3c0d7a5 A |
20 | $Control = [[\p{Grapheme_Cluster_Break = Control}]]; |
21 | $Extend = [[\p{Grapheme_Cluster_Break = Extend}]]; | |
22 | $ZWJ = [\p{Grapheme_Cluster_Break = ZWJ}]; | |
2ca993e8 | 23 | $Regional_Indicator = [\p{Grapheme_Cluster_Break = Regional_Indicator}]; |
f3c0d7a5 | 24 | $Prepend = [\p{Grapheme_Cluster_Break = Prepend}]; |
2ca993e8 A |
25 | $SpacingMark = [\p{Grapheme_Cluster_Break = SpacingMark}]; |
26 | ||
27 | # | |
340931cb A |
28 | # From cldr/common/properties/segments/ |
29 | # and issue CLDR-10994 | |
30 | # | |
31 | $Virama = [\p{Gujr}\p{sc=Telu}\p{sc=Mlym}\p{sc=Orya}\p{sc=Beng}\p{sc=Deva}&\p{Indic_Syllabic_Category=Virama}]; | |
32 | $LinkingConsonant = [\p{Gujr}\p{sc=Telu}\p{sc=Mlym}\p{sc=Orya}\p{sc=Beng}\p{sc=Deva}&\p{Indic_Syllabic_Category=Consonant}]; | |
33 | $ExtCccZwj = [[\p{gcb=Extend}-\p{ccc=0}] \p{gcb=ZWJ}]; | |
34 | ||
2ca993e8 A |
35 | # Korean Syllable Definitions |
36 | # | |
37 | $L = [\p{Grapheme_Cluster_Break = L}]; | |
38 | $V = [\p{Grapheme_Cluster_Break = V}]; | |
39 | $T = [\p{Grapheme_Cluster_Break = T}]; | |
40 | ||
41 | $LV = [\p{Grapheme_Cluster_Break = LV}]; | |
42 | $LVT = [\p{Grapheme_Cluster_Break = LVT}]; | |
43 | ||
44 | # Emoji defintions | |
45 | ||
0f5d89e8 | 46 | $Extended_Pict = [:ExtPict:]; |
f3c0d7a5 | 47 | |
0f5d89e8 A |
48 | # The following classes are no longer needed for ICU rules but may |
49 | # still be needed for WebKit rules in charClasses.txt | |
50 | # The first is still valid using the Unicode 11 properties: | |
51 | # $EmojiNRK = [[\p{Emoji}] - [\p{Grapheme_Cluster_Break = Regional_Indicator}*\u00230-9©®™〰〽]]; | |
52 | # The other two are no longer valid because no characters have GCB=EB or GCB=EBG anymore: | |
3d1f044b | 53 | # $E_Base = [[\p{Grapheme_Cluster_Break = EB}]; |
0f5d89e8 A |
54 | # $E_Base_GAZ = [\p{Grapheme_Cluster_Break = EBG}]; |
55 | # They must be replaced with updated versions as follows | |
3d1f044b | 56 | # $E_Base = [:EBase:]; |
340931cb | 57 | # $E_Base_GAZ = [\U0001F466-\U0001F469\U0001F91D\U0001F9D1]; # EBase that also occur after ZWJ in emoji-zwj-sequences |
2ca993e8 A |
58 | |
59 | ## ------------------------------------------------- | |
60 | !!chain; | |
61 | !!lookAheadHardBreak; | |
2ca993e8 A |
62 | |
63 | $CR $LF; | |
64 | ||
65 | $L ($L | $V | $LV | $LVT); | |
66 | ($LV | $V) ($V | $T); | |
67 | ($LVT | $T) $T; | |
68 | ||
69 | # GB 9 | |
70 | [^$Control $CR $LF] ($Extend | $ZWJ); | |
71 | ||
3d1f044b | 72 | # GB 9a |
2ca993e8 A |
73 | [^$Control $CR $LF] $SpacingMark; |
74 | ||
f3c0d7a5 A |
75 | # GB 9b |
76 | $Prepend [^$Control $CR $LF]; | |
2ca993e8 | 77 | |
340931cb A |
78 | # GB 9.3, from CLDR-10994 |
79 | $LinkingConsonant $ExtCccZwj* $Virama $ExtCccZwj* $LinkingConsonant; | |
80 | ||
0f5d89e8 A |
81 | # GB 11 Do not break within emoji modifier sequences or emoji zwj sequences. |
82 | $Extended_Pict $Extend* $ZWJ $Extended_Pict; | |
2ca993e8 A |
83 | |
84 | # GB 12-13. Keep pairs of regional indicators together | |
85 | # Note that hard break '/' rule triggers only if there are three or more initial RIs, | |
86 | ||
f3c0d7a5 A |
87 | ^$Prepend* $Regional_Indicator $Regional_Indicator / $Regional_Indicator; |
88 | ^$Prepend* $Regional_Indicator $Regional_Indicator; | |
2ca993e8 | 89 | |
0f5d89e8 A |
90 | # GB 999 Match a single code point if no other rule applies. |
91 | .; | |
2ca993e8 | 92 |