]>
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 | # | |
28 | # Korean Syllable Definitions | |
29 | # | |
30 | $L = [\p{Grapheme_Cluster_Break = L}]; | |
31 | $V = [\p{Grapheme_Cluster_Break = V}]; | |
32 | $T = [\p{Grapheme_Cluster_Break = T}]; | |
33 | ||
34 | $LV = [\p{Grapheme_Cluster_Break = LV}]; | |
35 | $LVT = [\p{Grapheme_Cluster_Break = LVT}]; | |
36 | ||
37 | # Emoji defintions | |
38 | ||
0f5d89e8 | 39 | $Extended_Pict = [:ExtPict:]; |
f3c0d7a5 | 40 | |
0f5d89e8 A |
41 | # The following classes are no longer needed for ICU rules but may |
42 | # still be needed for WebKit rules in charClasses.txt | |
43 | # The first is still valid using the Unicode 11 properties: | |
44 | # $EmojiNRK = [[\p{Emoji}] - [\p{Grapheme_Cluster_Break = Regional_Indicator}*\u00230-9©®™〰〽]]; | |
45 | # The other two are no longer valid because no characters have GCB=EB or GCB=EBG anymore: | |
3d1f044b | 46 | # $E_Base = [[\p{Grapheme_Cluster_Break = EB}]; |
0f5d89e8 A |
47 | # $E_Base_GAZ = [\p{Grapheme_Cluster_Break = EBG}]; |
48 | # They must be replaced with updated versions as follows | |
3d1f044b | 49 | # $E_Base = [:EBase:]; |
c5116b9f | 50 | # $E_Base_GAZ = [\U000026F9\U0001F466-\U0001F469\U0001F91D\U0001F9D1]; # EBase that also occur after ZWJ in emoji-zwj-sequences |
2ca993e8 A |
51 | |
52 | ## ------------------------------------------------- | |
53 | !!chain; | |
54 | !!lookAheadHardBreak; | |
2ca993e8 A |
55 | |
56 | $CR $LF; | |
57 | ||
58 | $L ($L | $V | $LV | $LVT); | |
59 | ($LV | $V) ($V | $T); | |
60 | ($LVT | $T) $T; | |
61 | ||
62 | # GB 9 | |
63 | [^$Control $CR $LF] ($Extend | $ZWJ); | |
64 | ||
3d1f044b | 65 | # GB 9a |
2ca993e8 A |
66 | [^$Control $CR $LF] $SpacingMark; |
67 | ||
f3c0d7a5 A |
68 | # GB 9b |
69 | $Prepend [^$Control $CR $LF]; | |
2ca993e8 | 70 | |
0f5d89e8 A |
71 | # GB 11 Do not break within emoji modifier sequences or emoji zwj sequences. |
72 | $Extended_Pict $Extend* $ZWJ $Extended_Pict; | |
2ca993e8 A |
73 | |
74 | # GB 12-13. Keep pairs of regional indicators together | |
75 | # Note that hard break '/' rule triggers only if there are three or more initial RIs, | |
76 | ||
f3c0d7a5 A |
77 | ^$Prepend* $Regional_Indicator $Regional_Indicator / $Regional_Indicator; |
78 | ^$Prepend* $Regional_Indicator $Regional_Indicator; | |
2ca993e8 | 79 | |
0f5d89e8 A |
80 | # GB 999 Match a single code point if no other rule applies. |
81 | .; | |
2ca993e8 | 82 |