• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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#  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
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
46$Extended_Pict = [:ExtPict:];
47
48## -------------------------------------------------
49!!chain;
50!!lookAheadHardBreak;
51
52$CR $LF;
53
54$L ($L | $V | $LV | $LVT);
55($LV | $V) ($V | $T);
56($LVT | $T) $T;
57
58# GB 9
59[^$Control $CR $LF] ($Extend | $ZWJ);
60
61# GB 9a
62[^$Control $CR $LF] $SpacingMark;
63
64# GB 9b
65$Prepend [^$Control $CR $LF];
66
67# GB 9.3, from CLDR-10994
68$LinkingConsonant $ExtCccZwj* $Virama $ExtCccZwj* $LinkingConsonant;
69
70# GB 11 Do not break within emoji modifier sequences or emoji zwj sequences.
71$Extended_Pict $Extend* $ZWJ $Extended_Pict;
72
73# GB 12-13. Keep pairs of regional indicators together
74#           Note that hard break '/' rule triggers only if there are three or more initial RIs,
75
76^$Prepend* $Regional_Indicator $Regional_Indicator / $Regional_Indicator;
77^$Prepend* $Regional_Indicator $Regional_Indicator;
78
79# GB 999 Match a single code point if no other rule applies.
80.;
81
82