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) 2016  International Business Machines Corporation and others. All Rights Reserved.
5#
6#  file:  line_normal_cj.txt
7#
8# Reference Line Break rules for intltest rbbi/RBBIMonkeyTest
9#
10# Note: Rule syntax and the monkey test itself are still a work in progress.
11#       They are expected to change with review and the addition of support for rule tailoring.
12#
13#         Line Breaking Rules
14#         Implement default line breaking as defined by
15#         Unicode Standard Annex #14 Revision 34 for Unicode 8.0
16#         http://www.unicode.org/reports/tr14/
17#         tailored as noted in 2nd paragraph below.
18#
19#         TODO:  Rule LB 8 remains as it was in Unicode 5.2
20#         This is only because of a limitation of ICU break engine implementation,
21#         not because the older behavior is desirable.
22#
23#         This tailors the line break behavior to correspond to CSS
24#         line-break=normal (BCP47 -u-lb-normal) as defined for Chinese & Japanese.
25#         It sets characters of class CJ to behave like ID.
26#         In addition, it allows breaks:
27#         * before hyphens 2010 & 2013 (both BA) and 301C, 30A0 (both NS)
28
29type = line;
30locale = ja@lb=normal;
31
32AI = [:LineBreak =  Ambiguous:];
33AL = [:LineBreak =  Alphabetic:];
34BAX = [\u2010 \u2013];
35BA = [[:LineBreak =  Break_After:] - BAX];
36BB = [:LineBreak =  Break_Before:];
37BK = [:LineBreak =  Mandatory_Break:];
38B2 = [:LineBreak =  Break_Both:];
39CB = [:LineBreak =  Contingent_Break:];
40CJ = [:LineBreak =  Conditional_Japanese_Starter:];
41CL = [:LineBreak =  Close_Punctuation:];
42CM = [:LineBreak =  Combining_Mark:];
43CP = [:LineBreak =  Close_Parenthesis:];
44CR = [:LineBreak =  Carriage_Return:];
45EB = [[:LineBreak =  EB:]\U0001F3C2\U0001F3C7\U0001F3CC\U0001F46A-\U0001F46D\U0001F46F\U0001F574\U0001F6CC];
46EM = [:LineBreak =  EM:];
47EX = [:LineBreak =  Exclamation:];
48GL = [:LineBreak =  Glue:];
49HL = [:LineBreak =  Hebrew_Letter:];
50HY = [:LineBreak =  Hyphen:];
51H2 = [:LineBreak =  H2:];
52H3 = [:LineBreak =  H3:];
53ID = [[:LineBreak =  Ideographic:] CJ];  # CSS Normal tailoring: CJ resolves to ID
54IN = [:LineBreak =  Inseperable:];
55IS = [:LineBreak =  Infix_Numeric:];
56JL = [:LineBreak =  JL:];
57JV = [:LineBreak =  JV:];
58JT = [:LineBreak =  JT:];
59LF = [:LineBreak =  Line_Feed:];
60NL = [:LineBreak =  Next_Line:];
61NSX = [\u301C \u30A0];
62NS = [[:LineBreak =  Nonstarter:] - NSX];
63NU = [:LineBreak =  Numeric:];
64OP = [:LineBreak =  Open_Punctuation:];
65PO = [:LineBreak =  Postfix_Numeric:];
66PR = [:LineBreak =  Prefix_Numeric:];
67QU = [:LineBreak =  Quotation:];
68RI = [:LineBreak =  Regional_Indicator:];
69SA = [:LineBreak =  Complex_Context:];
70SG = [:LineBreak =  Surrogate:];
71SP = [:LineBreak =  Space:];
72SY = [:LineBreak =  Break_Symbols:];
73WJ = [:LineBreak =  Word_Joiner:];
74XX = [:LineBreak =  Unknown:];
75ZW = [:LineBreak =  ZWSpace:];
76ZWJ = [:LineBreak =  ZWJ:];
77
78EmojiNRK = [[\p{Emoji}] - [[RI]\u002a\u00230-9©®™〰〽]];
79# Data for Extended Pictographic scraped from CLDR common/properties/ExtendedPictographic.txt, r12773
80Extended_Pict = [\U0001F774-\U0001F77F\u2700-\u2701\u2703-\u2704\u270E\u2710-\u2711\u2765-\u2767\U0001F030-\U0001F093\U0001F094-\U0001F09F\U0001F10D-\U0001F10F\U0001F12F\U0001F16C-\U0001F16F\U0001F1AD-\U0001F1E5\U0001F203-\U0001F20F\U0001F23C-\U0001F23F\U0001F249-\U0001F24F\U0001F252-\U0001F2FF\U0001F7D5-\U0001F7FF\U0001F000-\U0001F003\U0001F005-\U0001F02B\U0001F02C-\U0001F02F\U0001F322-\U0001F323\U0001F394-\U0001F395\U0001F398\U0001F39C-\U0001F39D\U0001F3F1-\U0001F3F2\U0001F3F6\U0001F4FE\U0001F53E-\U0001F548\U0001F54F\U0001F568-\U0001F56E\U0001F571-\U0001F572\U0001F57B-\U0001F586\U0001F588-\U0001F589\U0001F58E-\U0001F58F\U0001F591-\U0001F594\U0001F597-\U0001F5A3\U0001F5A6-\U0001F5A7\U0001F5A9-\U0001F5B0\U0001F5B3-\U0001F5BB\U0001F5BD-\U0001F5C1\U0001F5C5-\U0001F5D0\U0001F5D4-\U0001F5DB\U0001F5DF-\U0001F5E0\U0001F5E2\U0001F5E4-\U0001F5E7\U0001F5E9-\U0001F5EE\U0001F5F0-\U0001F5F2\U0001F5F4-\U0001F5F9\u2605\u2607-\u260D\u260F-\u2610\u2612\u2616-\u2617\u2619-\u261C\u261E-\u261F\u2621\u2624-\u2625\u2627-\u2629\u262B-\u262D\u2630-\u2637\u263B-\u2647\u2654-\u265F\u2661-\u2662\u2664\u2667\u2669-\u267A\u267C-\u267E\u2680-\u2691\u2695\u2698\u269A\u269D-\u269F\u26A2-\u26A9\u26AC-\u26AF\u26B2-\u26BC\u26BF-\u26C3\u26C6-\u26C7\u26C9-\u26CD\u26D0\u26D2\u26D5-\u26E8\u26EB-\u26EF\u26F6\u26FB-\u26FC\u26FE-\u26FF\u2388\U0001FA00-\U0001FFFD\U0001F0A0-\U0001F0AE\U0001F0B1-\U0001F0BF\U0001F0C1-\U0001F0CF\U0001F0D1-\U0001F0F5\U0001F0AF-\U0001F0B0\U0001F0C0\U0001F0D0\U0001F0F6-\U0001F0FF\U0001F80C-\U0001F80F\U0001F848-\U0001F84F\U0001F85A-\U0001F85F\U0001F888-\U0001F88F\U0001F8AE-\U0001F8FF\U0001F900-\U0001F90F\U0001F91F\U0001F928-\U0001F92F\U0001F931-\U0001F932\U0001F93F\U0001F94C-\U0001F94F\U0001F95F-\U0001F97F\U0001F992-\U0001F9BF\U0001F9C1-\U0001F9FF\U0001F6C6-\U0001F6CA\U0001F6E6-\U0001F6E8\U0001F6EA\U0001F6F1-\U0001F6F2\U0001F6D3-\U0001F6DF\U0001F6ED-\U0001F6EF\U0001F6F7-\U0001F6FF];
81
82# LB1 - Resolve AI, CB, CJ, SA, SG, and XX into other line breaking classes
83AL = [AL AI SG XX ];
84dictionary = SA;
85
86# By LB9, a ZWJ also behaves as a CM. Including it in the definition of CM avoids having to explicitly
87#         list it in the numerous rules that use CM.
88CM = [CM ZWJ];
89
90LB4:        BK ÷;
91LB5:        CR LF;
92LB5.1:      CR ÷;
93LB5.2:      LF ÷;
94LB5.3:      NL ÷;
95
96LB6:        . (BK | CR | LF | NL);
97LB6.1:      [^BK CR LF NL SP ZW] CM* (BK | CR | LF | NL);
98
99# Rules LB14 - LB17.
100# Moved before LB7, because they can match a longer sequence that would also match LB7,
101# for example, the sequence "OP CM SP AL" matches LB14 while the prefix of it,
102#                           "while only the prefix "OP CM SP" matches LB7.1
103LB14:        OP CM* SP* .;
104LB15:        QU CM* SP* OP;
105
106# Do not break between closing punctuation and $NS, even with intervening spaces
107# But DO allow a break between closing punctuation and $NSX, don't include it here
108LB16:        (CL | CP)CM* SP* NS;
109LB17:        B2 CM* SP* B2;
110
111LB7.1:      [^ZW SP] CM* [SP ZW];
112LB7.2:      [ZW SP] [SP ZW];
113
114# LB8, ICU differs from UAX-14,
115#    ICU:    ZW ÷;
116#    UAX 14: ZW SP* ÷;
117LB8:        ZW ÷;
118
119# LB8a
120#      ZWJ x (ID | Extended_Pict | EmojiNRK)
121LB8a:       ZWJ (ID | Extended_Pict | EmojiNRK);
122
123
124# LB9:  X CM -> X
125# LB10: Unattached CM -> AL
126
127#LB11:       × WJ;
128#            WJ ×
129
130LB11.1:      [^BK CR LF NL SP ZW] CM* WJ;
131LB11.2:      SP WJ;
132LB11.3:      WJ CM* [^CM];
133
134LB12:        GL CM* [^CM];
135
136LB12a:       [^SP BA BAX HY] CM* GL;
137
138# LB 13 ICU Tailoring, matches tailoring exmaple 8 from UAX 14.
139#
140#   LB13.1   [^SP] CM* [CL CP EX IS SY]    # original UAX 14 rule.
141#   LB13.2   SP    CM* [CL CP EX IS SY]
142
143LB13.1: [^NU SP] CM* [CL CP IS SY];
144LB13.2: [^SP] CM* EX;
145LB13.2: SP [CL CP EX IS SY];
146
147
148# LB 14-17 are moved above LB 7.
149
150LB18:        SP ÷;
151
152LB19:        . CM* QU;
153LB19.1:      QU CM* [^CM];
154
155# LB 20   Break before and after CB.
156#         Interaction with LB8a:  ZWJ x ID is tricky because CM includes ZWJ.
157#                                 ZWJ acts like a CM to the left, combining with CB.
158#                                 ZWJ acts independently to the right, no break from ID by LB8a.
159LB20:        . CM* ÷ CB;
160LB20.1a:     CB CM* ZWJ (ID | Extended_Pict | EmojiNRK);
161LB20.1b:      CB CM* ÷;
162
163# Note: Rule 21a must come before 21 to prevent 21.1 from matching HL BA, then
164#       not picking up the continuing match after the BA from 21a.
165# TODO: For CJ tailorings (with BAX) does this rule want to include BAX? If so,
166#       should "HL BAX" not break when followed by a CB? Thats what the current
167#       rules do, which is why "[^CM CB]?" includes the ?.
168LB21a:       HL CM* (HY | BA | BAX) CM* [^CM CB]?;
169
170# DO allow breaks here before $BAXcm and $NSXcm, so don't include them
171LB21.1:      . CM* [BA HY NS];
172LB21.2:      BB CM* [^CM CB];
173
174LB21b:       SY CM* HL;
175
176LB22.1:        (AL | HL | CM) CM* IN;   # The CM is from LB10, treat an unattached CM as AL.
177LB22.2:       EX CM* IN;
178LB22.3:       (ID | EB | EM) CM* IN;
179LB22.4:       IN CM* IN;
180LB22.5:       NU CM* IN;
181
182LB23.1:      (AL | HL | CM) CM* NU;
183LB23.2:      NU CM* (AL | HL);
184
185LB23a.1:     PR CM* (ID | EB | EM);
186LB23a.2:     (ID | EB | EM) CM* PO;
187
188LB24.2:      (PR | PO) CM* (AL | HL);
189LB24.3:      (AL | HL | CM) CM* (PR | PO);
190
191# Numbers. Equivalent to Tailoring example 8 from UAx 14.
192LB25:        ((PR | PO)CM*)? ((OP | HY)CM*)? NU (CM*(NU | SY | IS))* (CM*(CL | CP))? (CM*(PR | PO))?;
193
194LB26.1:      JL CM* (JL | JV | H2 | H3);
195LB26.2:      (JV | H2) CM* (JV | JT);
196LB26.3:      (JT | H3) CM* JT;
197
198LB27.1:      (JL | JV | JT | H2 | H3) CM* IN;
199LB27.2:      (JL | JV | JT | H2 | H3) CM* PO;
200LB27.3:      PR CM* (JL | JV | JT | H2 | H3);
201
202# LB28 Do not break between Alphabetics.
203#      Unattached (leading) CM treated as AL.
204LB28:        (AL | HL | CM)CM* (AL | HL);
205
206LB29:        IS CM* (AL | HL);
207
208# LB30  is adjusted for unattached leading CM being treated as AL.
209LB30.1:      (AL | CM | HL | NU) CM* OP;
210LB30.2:      CP CM* (AL | HL | NU);
211
212# LB31  keep pairs of RI together.
213LB30a.1:     RI CM* RI CM* [BK CR LF NL SP ZW WJ GL CL CP EX IS SY QU BA HY NS];
214LB30a.2:     RI CM* RI CM* ZWJ (ID | Extended_Pict | EmojiNRK);
215LB30a.3:     RI CM* RI CM* ÷;
216
217# LB30b Do not break between Emoji Base and Emoji Modifier
218LB30b:       EB CM* EM;
219
220# LB31 Break Everywhere Else.
221#      Include combining marks
222LB31.1:        . CM* ZWJ (ID | Extended_Pict | EmojiNRK);
223LB31.2:        . CM* ÷;
224