]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
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. | |
2ca993e8 A |
5 | # |
6 | # file: line_normal_cj.txt | |
7 | # | |
0f5d89e8 A |
8 | # Reference Line Break rules for intltest rbbi/RBBIMonkeyTest. |
9 | # Rules derived from Unicode Standard Annex #14 Revision 40 for Unicode 11.0 | |
2ca993e8 A |
10 | # |
11 | # Note: Rule syntax and the monkey test itself are still a work in progress. | |
12 | # They are expected to change with review and the addition of support for rule tailoring. | |
13 | # | |
14 | # Line Breaking Rules | |
f3c0d7a5 | 15 | # Implement default line breaking as defined by |
2ca993e8 A |
16 | # Unicode Standard Annex #14 Revision 34 for Unicode 8.0 |
17 | # http://www.unicode.org/reports/tr14/ | |
f3c0d7a5 | 18 | # tailored as noted in 2nd paragraph below. |
2ca993e8 A |
19 | # |
20 | # TODO: Rule LB 8 remains as it was in Unicode 5.2 | |
21 | # This is only because of a limitation of ICU break engine implementation, | |
22 | # not because the older behavior is desirable. | |
23 | # | |
24 | # This tailors the line break behavior to correspond to CSS | |
25 | # line-break=normal (BCP47 -u-lb-normal) as defined for Chinese & Japanese. | |
26 | # It sets characters of class CJ to behave like ID. | |
27 | # In addition, it allows breaks: | |
28 | # * before hyphens 2010 & 2013 (both BA) and 301C, 30A0 (both NS) | |
3d1f044b | 29 | # It allows breaking before 201C and after 201D, for zh_Hans, zh_Hant, and ja. |
2ca993e8 A |
30 | |
31 | type = line; | |
32 | locale = ja@lb=normal; | |
33 | ||
f3c0d7a5 A |
34 | AI = [:LineBreak = Ambiguous:]; |
35 | AL = [:LineBreak = Alphabetic:]; | |
2ca993e8 A |
36 | BAX = [\u2010 \u2013]; |
37 | BA = [[:LineBreak = Break_After:] - BAX]; | |
3d1f044b | 38 | HH = [\u2010]; # \u2010 is HYPHEN, default line break is BA. |
2ca993e8 A |
39 | BB = [:LineBreak = Break_Before:]; |
40 | BK = [:LineBreak = Mandatory_Break:]; | |
41 | B2 = [:LineBreak = Break_Both:]; | |
42 | CB = [:LineBreak = Contingent_Break:]; | |
43 | CJ = [:LineBreak = Conditional_Japanese_Starter:]; | |
3d1f044b A |
44 | CL = [[:LineBreak = Close_Punctuation:] \u201d]; |
45 | CMS = [:LineBreak = Combining_Mark:]; | |
2ca993e8 A |
46 | CP = [:LineBreak = Close_Parenthesis:]; |
47 | CR = [:LineBreak = Carriage_Return:]; | |
f3c0d7a5 A |
48 | EB = [[:LineBreak = EB:] \U0001F46A-\U0001F46D\U0001F46F\U0001F91D\U0001F93C]; |
49 | EM = [:LineBreak = EM:]; | |
2ca993e8 A |
50 | EX = [:LineBreak = Exclamation:]; |
51 | GL = [:LineBreak = Glue:]; | |
52 | HL = [:LineBreak = Hebrew_Letter:]; | |
53 | HY = [:LineBreak = Hyphen:]; | |
54 | H2 = [:LineBreak = H2:]; | |
55 | H3 = [:LineBreak = H3:]; | |
f3c0d7a5 | 56 | ID = [[:LineBreak = Ideographic:] CJ]; # CSS Normal tailoring: CJ resolves to ID |
2ca993e8 A |
57 | IN = [:LineBreak = Inseperable:]; |
58 | IS = [:LineBreak = Infix_Numeric:]; | |
59 | JL = [:LineBreak = JL:]; | |
60 | JV = [:LineBreak = JV:]; | |
61 | JT = [:LineBreak = JT:]; | |
62 | LF = [:LineBreak = Line_Feed:]; | |
63 | NL = [:LineBreak = Next_Line:]; | |
64 | NSX = [\u301C \u30A0]; | |
65 | NS = [[:LineBreak = Nonstarter:] - NSX]; | |
66 | NU = [:LineBreak = Numeric:]; | |
3d1f044b | 67 | OP = [[:LineBreak = Open_Punctuation:] \u201c]; |
2ca993e8 A |
68 | PO = [:LineBreak = Postfix_Numeric:]; |
69 | PR = [:LineBreak = Prefix_Numeric:]; | |
3d1f044b | 70 | QU = [[:LineBreak = Quotation:] - [\u201c\u201d]]; |
2ca993e8 A |
71 | RI = [:LineBreak = Regional_Indicator:]; |
72 | SA = [:LineBreak = Complex_Context:]; | |
73 | SG = [:LineBreak = Surrogate:]; | |
74 | SP = [:LineBreak = Space:]; | |
75 | SY = [:LineBreak = Break_Symbols:]; | |
76 | WJ = [:LineBreak = Word_Joiner:]; | |
77 | XX = [:LineBreak = Unknown:]; | |
78 | ZW = [:LineBreak = ZWSpace:]; | |
f3c0d7a5 | 79 | ZWJ = [:LineBreak = ZWJ:]; |
2ca993e8 | 80 | |
f3c0d7a5 A |
81 | # LB1 - Resolve AI, CB, CJ, SA, SG, and XX into other line breaking classes |
82 | AL = [AL AI SG XX ]; | |
83 | dictionary = SA; | |
2ca993e8 | 84 | |
f3c0d7a5 A |
85 | # By LB9, a ZWJ also behaves as a CM. Including it in the definition of CM avoids having to explicitly |
86 | # list it in the numerous rules that use CM. | |
3d1f044b | 87 | CM = [CMS ZWJ]; |
2ca993e8 A |
88 | |
89 | LB4: BK ÷; | |
90 | LB5: CR LF; | |
91 | LB5.1: CR ÷; | |
92 | LB5.2: LF ÷; | |
93 | LB5.3: NL ÷; | |
94 | ||
95 | LB6: . (BK | CR | LF | NL); | |
96 | LB6.1: [^BK CR LF NL SP ZW] CM* (BK | CR | LF | NL); | |
97 | ||
3d1f044b A |
98 | # LB8 break after ZW SP*. |
99 | # Precedes LB7 because both rules will match the sequences like ZW SP, | |
100 | # and LB8 must take precedence. | |
101 | ||
102 | LB8: ZW SP* ÷ [^ZW SP BK CR LF NL]; | |
103 | ||
104 | # Numbers. Equivalent to Tailoring example 8 from UAX 14. | |
105 | # Moved up, before LB14, because it can match longer sequences which must take precedence. | |
106 | LB25: ((PR | PO)CM*)? ((OP | HY)CM*)? (IS CM*)? NU (CM*(NU | SY | IS))* (CM*(CL | CP))? (CM*(PR | PO))?; | |
107 | ||
2ca993e8 | 108 | # Rules LB14 - LB17. |
3d1f044b A |
109 | # Moved up, before LB7, because they can match a longer sequence that would also match LB7. |
110 | # For example, the sequence "OP CM SP AL" matches LB14 | |
111 | # while the prefix of it, "OP CM SP" matches LB7.1 | |
2ca993e8 | 112 | LB14: OP CM* SP* .; |
3d1f044b A |
113 | |
114 | # LB 14a Break before an IS that begins a number and follows a space. | |
115 | LB14a: SP ÷ IS CM* NU; | |
116 | ||
117 | # LB14b × IS | |
118 | LB14b.1: [^SP] CM* IS; | |
119 | LB14b.2: SP IS; | |
120 | ||
2ca993e8 A |
121 | LB15: QU CM* SP* OP; |
122 | ||
123 | # Do not break between closing punctuation and $NS, even with intervening spaces | |
124 | # But DO allow a break between closing punctuation and $NSX, don't include it here | |
125 | LB16: (CL | CP)CM* SP* NS; | |
126 | LB17: B2 CM* SP* B2; | |
127 | ||
3d1f044b A |
128 | # LB7 Do not break before spaces or zero width space. |
129 | ||
2ca993e8 A |
130 | LB7.1: [^ZW SP] CM* [SP ZW]; |
131 | LB7.2: [ZW SP] [SP ZW]; | |
132 | ||
f3c0d7a5 | 133 | # LB8a |
0f5d89e8 A |
134 | # ZWJ x |
135 | # Don't match a CM on the right - let other rules pick up CM sequences, where | |
136 | # the ZWJ behaves as just another generic CM. | |
137 | LB8a: ZWJ [^CM]; | |
2ca993e8 A |
138 | |
139 | ||
140 | # LB9: X CM -> X | |
141 | # LB10: Unattached CM -> AL | |
142 | ||
143 | #LB11: × WJ; | |
144 | # WJ × | |
145 | ||
0f5d89e8 | 146 | LB11.1: [^SP] CM* WJ; |
2ca993e8 A |
147 | LB11.2: SP WJ; |
148 | LB11.3: WJ CM* [^CM]; | |
149 | ||
150 | LB12: GL CM* [^CM]; | |
151 | ||
152 | LB12a: [^SP BA BAX HY] CM* GL; | |
153 | ||
3d1f044b A |
154 | # LB 13 Do not break before ‘]’ or ‘!’ or ‘/’, even after spaces. |
155 | LB13.1: [^SP] CM* [CL CP EX SY]; | |
156 | LB13.2: SP [CL CP EX SY]; | |
2ca993e8 A |
157 | |
158 | # LB 14-17 are moved above LB 7. | |
159 | ||
160 | LB18: SP ÷; | |
161 | ||
162 | LB19: . CM* QU; | |
163 | LB19.1: QU CM* [^CM]; | |
164 | ||
165 | # LB 20 Break before and after CB. | |
0f5d89e8 | 166 | # Interaction with LB8a: ZWJ x . is tricky because CM includes ZWJ. |
f3c0d7a5 | 167 | # ZWJ acts like a CM to the left, combining with CB. |
0f5d89e8 A |
168 | # ZWJ acts independently to the right, no break after by LB8a. |
169 | LB20.1: . CM* ZWJ CB; | |
170 | LB20.2: . CM* ÷ CB; | |
171 | ||
172 | LB20.3: CB CM* ZWJ [^CM]; | |
173 | LB20.4: CB CM* ÷; | |
2ca993e8 | 174 | |
3d1f044b A |
175 | # LB 20.09 Don't break between Hyphens and Letters when there is a break preceding the hyphen. |
176 | LB20.09: ^(HY | HH) CM* AL; | |
177 | ||
2ca993e8 A |
178 | # Note: Rule 21a must come before 21 to prevent 21.1 from matching HL BA, then |
179 | # not picking up the continuing match after the BA from 21a. | |
180 | # TODO: For CJ tailorings (with BAX) does this rule want to include BAX? If so, | |
181 | # should "HL BAX" not break when followed by a CB? Thats what the current | |
f3c0d7a5 | 182 | # rules do, which is why "[^CM CB]?" includes the ?. |
2ca993e8 A |
183 | LB21a: HL CM* (HY | BA | BAX) CM* [^CM CB]?; |
184 | ||
185 | # DO allow breaks here before $BAXcm and $NSXcm, so don't include them | |
186 | LB21.1: . CM* [BA HY NS]; | |
187 | LB21.2: BB CM* [^CM CB]; | |
188 | ||
189 | LB21b: SY CM* HL; | |
190 | ||
191 | LB22.1: (AL | HL | CM) CM* IN; # The CM is from LB10, treat an unattached CM as AL. | |
192 | LB22.2: EX CM* IN; | |
193 | LB22.3: (ID | EB | EM) CM* IN; | |
194 | LB22.4: IN CM* IN; | |
195 | LB22.5: NU CM* IN; | |
196 | ||
f3c0d7a5 A |
197 | LB23.1: (AL | HL | CM) CM* NU; |
198 | LB23.2: NU CM* (AL | HL); | |
199 | ||
200 | LB23a.1: PR CM* (ID | EB | EM); | |
201 | LB23a.2: (ID | EB | EM) CM* PO; | |
2ca993e8 | 202 | |
f3c0d7a5 A |
203 | LB24.2: (PR | PO) CM* (AL | HL); |
204 | LB24.3: (AL | HL | CM) CM* (PR | PO); | |
2ca993e8 | 205 | |
2ca993e8 A |
206 | LB26.1: JL CM* (JL | JV | H2 | H3); |
207 | LB26.2: (JV | H2) CM* (JV | JT); | |
208 | LB26.3: (JT | H3) CM* JT; | |
209 | ||
210 | LB27.1: (JL | JV | JT | H2 | H3) CM* IN; | |
211 | LB27.2: (JL | JV | JT | H2 | H3) CM* PO; | |
212 | LB27.3: PR CM* (JL | JV | JT | H2 | H3); | |
213 | ||
214 | # LB28 Do not break between Alphabetics. | |
215 | # Unattached (leading) CM treated as AL. | |
216 | LB28: (AL | HL | CM)CM* (AL | HL); | |
217 | ||
218 | LB29: IS CM* (AL | HL); | |
219 | ||
220 | # LB30 is adjusted for unattached leading CM being treated as AL. | |
221 | LB30.1: (AL | CM | HL | NU) CM* OP; | |
222 | LB30.2: CP CM* (AL | HL | NU); | |
223 | ||
0f5d89e8 | 224 | # LB30a keep pairs of RI together. |
3d1f044b A |
225 | LB30a.1: RI CM* RI ÷ [^BK CR LF NL SP ZW WJ CL CP EX IS SY GL QU BA HY NS CM]; |
226 | LB30a.2: RI CM* RI CM* CMS ÷ [^BK CR LF NL SP ZW WJ CL CP EX IS SY GL QU BA HY NS CM]; | |
0f5d89e8 | 227 | LB30a.3: RI CM* RI CM* [BK CR LF NL SP ZW WJ GL CL CP EX IS SY QU BA HY NS ZWJ]?; |
2ca993e8 A |
228 | |
229 | # LB30b Do not break between Emoji Base and Emoji Modifier | |
230 | LB30b: EB CM* EM; | |
231 | ||
232 | # LB31 Break Everywhere Else. | |
233 | # Include combining marks | |
0f5d89e8 | 234 | LB31.1: . CM* ZWJ [^CM]; |
2ca993e8 | 235 | LB31.2: . CM* ÷; |