]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Copyright (C) 2016 and later: Unicode, Inc. and others. | |
3 | # License & terms of use: http://www.unicode.org/copyright.html | |
4 | # Copyright (C) 2002-2016, International Business Machines Corporation and others. | |
5 | # All Rights Reserved. | |
6 | # | |
7 | # file: char.txt | |
8 | # | |
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 | |
12 | ||
13 | !!quoted_literals_only; | |
14 | ||
15 | # | |
16 | # Character Class Definitions. | |
17 | # | |
18 | $CR = [\p{Grapheme_Cluster_Break = CR}]; | |
19 | $LF = [\p{Grapheme_Cluster_Break = LF}]; | |
20 | $Control = [[\p{Grapheme_Cluster_Break = Control}]]; | |
21 | $Extend = [[\p{Grapheme_Cluster_Break = Extend}]]; | |
22 | $ZWJ = [\p{Grapheme_Cluster_Break = ZWJ}]; | |
23 | $Regional_Indicator = [\p{Grapheme_Cluster_Break = Regional_Indicator}]; | |
24 | $Prepend = [\p{Grapheme_Cluster_Break = Prepend}]; | |
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 | ||
39 | $Extended_Pict = [:ExtPict:]; | |
40 | ||
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: | |
46 | # $E_Base = [[\p{Grapheme_Cluster_Break = EB}]; | |
47 | # $E_Base_GAZ = [\p{Grapheme_Cluster_Break = EBG}]; | |
48 | # They must be replaced with updated versions as follows | |
49 | # $E_Base = [:EBase:]; | |
50 | # $E_Base_GAZ = [\U000026F9\U0001F466-\U0001F469\U0001F91D\U0001F9D1]; # EBase that also occur after ZWJ in emoji-zwj-sequences | |
51 | ||
52 | ## ------------------------------------------------- | |
53 | !!chain; | |
54 | !!lookAheadHardBreak; | |
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 | ||
65 | # GB 9a | |
66 | [^$Control $CR $LF] $SpacingMark; | |
67 | ||
68 | # GB 9b | |
69 | $Prepend [^$Control $CR $LF]; | |
70 | ||
71 | # GB 11 Do not break within emoji modifier sequences or emoji zwj sequences. | |
72 | $Extended_Pict $Extend* $ZWJ $Extended_Pict; | |
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 | ||
77 | ^$Prepend* $Regional_Indicator $Regional_Indicator / $Regional_Indicator; | |
78 | ^$Prepend* $Regional_Indicator $Regional_Indicator; | |
79 | ||
80 | # GB 999 Match a single code point if no other rule applies. | |
81 | .; | |
82 |