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