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.txt 7# 8# Reference Line Break rules for intltest rbbi/RBBIMonkeyTest. 9# Rules derived from Unicode Standard Annex #14 for Unicode 14.0. 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 15type = line; 16locale = zh; 17 18 19AI = [:LineBreak = Ambiguous:]; 20AL = [:LineBreak = Alphabetic:]; 21BA = [:LineBreak = Break_After:]; 22HH = [\u2010]; # \u2010 is HYPHEN, default line break is BA. 23BB = [:LineBreak = Break_Before:]; 24BK = [:LineBreak = Mandatory_Break:]; 25B2 = [:LineBreak = Break_Both:]; 26CB = [:LineBreak = Contingent_Break:]; 27CJ = [:LineBreak = Conditional_Japanese_Starter:]; 28CL = [[:LineBreak = Close_Punctuation:] \u201d]; 29CMS = [:LineBreak = Combining_Mark:]; 30CP = [:LineBreak = Close_Parenthesis:]; 31CR = [:LineBreak = Carriage_Return:]; 32EB = [:LineBreak = EB:]; 33EM = [:LineBreak = EM:]; 34EX = [:LineBreak = Exclamation:]; 35GL = [:LineBreak = Glue:]; 36HL = [:LineBreak = Hebrew_Letter:]; 37HY = [:LineBreak = Hyphen:]; 38H2 = [:LineBreak = H2:]; 39H3 = [:LineBreak = H3:]; 40ID = [:LineBreak = Ideographic:]; 41IN = [:LineBreak = Inseperable:]; 42IS = [:LineBreak = Infix_Numeric:]; 43JL = [:LineBreak = JL:]; 44JV = [:LineBreak = JV:]; 45JT = [:LineBreak = JT:]; 46LF = [:LineBreak = Line_Feed:]; 47NL = [:LineBreak = Next_Line:]; 48NS = [[:LineBreak = Nonstarter:] CJ]; # CSS Strict tailoring: CJ resolves to NS. 49NU = [:LineBreak = Numeric:]; 50OP = [[:LineBreak = Open_Punctuation:] \u201c]; 51PO = [:LineBreak = Postfix_Numeric:]; 52PR = [:LineBreak = Prefix_Numeric:]; 53QU = [[:LineBreak = Quotation:] - [\u201c\u201d]]; 54RI = [:LineBreak = Regional_Indicator:]; 55SA = [:LineBreak = Complex_Context:]; 56SG = [:LineBreak = Surrogate:]; 57SP = [:LineBreak = Space:]; 58SY = [:LineBreak = Break_Symbols:]; 59WJ = [:LineBreak = Word_Joiner:]; 60XX = [:LineBreak = Unknown:]; 61ZW = [:LineBreak = ZWSpace:]; 62ZWJ = [:LineBreak = ZWJ:]; 63 64# OP30 and CP30 are variants of OP and CP that appear in rule LB30 from UAX 14. 65# Limitations of this monkey test rule parser require that these definitions be pulled out 66# rather than appearing in-line in LB 30. 67 68OP30 = [OP - [\p{ea=F}\p{ea=W}\p{ea=H}]]; 69CP30 = [CP - [\p{ea=F}\p{ea=W}\p{ea=H}]]; 70 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 75OP30 = [OP - [\p{ea=F}\p{ea=W}\p{ea=H}]]; 76CP30 = [CP - [\p{ea=F}\p{ea=W}\p{ea=H}]]; 77 78# The redundant-looking inner brackets are required for the current parser in the test code. 79ExtPictUnassigned = [[\p{Extended_Pictographic}]&[\p{Cn}]]; 80 81# LB1 - Resolve AI, CB, CJ, SA, SG, and XX into other line breaking classes 82AL = [AL AI SG XX ]; 83dictionary = SA; 84 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. 87CM = [CMS ZWJ]; 88 89LB4: BK ÷; 90LB5: CR LF; 91LB5.1: CR ÷; 92LB5.2: LF ÷; 93LB5.3: NL ÷; 94 95LB6: . (BK | CR | LF | NL); 96LB6.1: [^BK CR LF NL SP ZW] CM* (BK | CR | LF | NL); 97 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 102LB8: 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. 106LB25: ((PR | PO)CM*)? ((OP | HY)CM*)? (IS CM*)? NU (CM*(NU | SY | IS))* (CM*(CL | CP))? (CM*(PR | PO))?; 107 108# Rules LB14 - LB17. 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 112LB14: OP CM* SP* .; 113 114# LB 14a Break before an IS that begins a number and follows a space. 115LB14a: SP ÷ IS CM* NU; 116 117# LB14b × IS 118LB14b.1: [^SP] CM* IS; 119LB14b.2: SP IS; 120 121LB15: QU CM* SP* OP; 122LB16: (CL | CP)CM* SP* NS; 123LB17: B2 CM* SP* B2; 124 125 126# LB7 Do not break before spaces or zero width space. 127 128LB7.1: [^ZW SP] CM* [SP ZW]; 129LB7.2: [ZW SP] [SP ZW]; 130 131# LB8a 132# ZWJ x 133# Don't match a CM on the right - let other rules pick up CM sequences, where 134# the ZWJ behaves as just another generic CM. 135LB8a: ZWJ [^CM]; 136 137 138# LB9: X CM -> X 139# LB10: Unattached CM -> AL 140 141#LB11: × WJ; 142# WJ × 143 144LB11.1: [^SP] CM* WJ; 145LB11.2: SP WJ; 146LB11.3: WJ CM* [^CM]; 147 148LB12: GL CM* [^CM]; 149 150LB12a: [^SP BA HY] CM* GL; 151 152# LB 13 Do not break before ‘]’ or ‘!’ or ‘/’, even after spaces. 153LB13.1: [^SP] CM* [CL CP EX SY]; 154LB13.2: SP [CL CP EX SY]; 155 156# LB 14-17 are moved above LB 7. 157 158LB18: SP ÷; 159 160LB19: . CM* QU; 161LB19.1: QU CM* [^CM]; 162 163# LB 20 Break before and after CB. 164# Interaction with LB8a: ZWJ x . is tricky because CM includes ZWJ. 165# ZWJ acts like a CM to the left, combining with CB. 166# ZWJ acts independently to the right, no break after by LB8a. 167LB20.1: . CM* ZWJ CB; 168LB20.2: . CM* ÷ CB; 169 170LB20.3: CB CM* ZWJ [^CM]; 171LB20.4: CB CM* ÷; 172 173# LB 20.09 Don't break between Hyphens and Letters when there is a break preceding the hyphen. 174LB20.09: ^(HY | HH) CM* AL; 175 176# Note: Rule 21a must come before 21 to prevent 21.1 from matching HL BA, then 177# not picking up the continuing match after the BA from 21a. 178LB21a: HL CM* (HY | BA) CM* [^CM CB]; 179 180LB21.1: . CM* [BA HY NS]; 181LB21.2: BB CM* [^CM CB]; 182 183LB21b: SY CM* HL; 184 185LB22: . CM* IN; 186 187LB23.1: (AL | HL | CM) CM* NU; 188LB23.2: NU CM* (AL | HL); 189 190LB23a.1: PR CM* (ID | EB | EM); 191LB23a.2: (ID | EB | EM) CM* PO; 192 193LB24.2: (PR | PO) CM* (AL | HL); 194LB24.3: (AL | HL | CM) CM* (PR | PO); 195 196 197LB26.1: JL CM* (JL | JV | H2 | H3); 198LB26.2: (JV | H2) CM* (JV | JT); 199LB26.3: (JT | H3) CM* JT; 200 201LB27.1: (JL | JV | JT | H2 | H3) CM* PO; 202LB27.2: PR CM* (JL | JV | JT | H2 | H3); 203 204# LB28 Do not break between Alphabetics. 205# Unattached (leading) CM treated as AL. 206LB28: (AL | HL | CM)CM* (AL | HL); 207 208LB29: IS CM* (AL | HL); 209 210# LB30 is adjusted for unattached leading CM being treated as AL. 211LB30.1: (AL | CM | HL | NU) CM* OP30; 212LB30.2: CP30 CM* (AL | HL | NU); 213 214# LB30a keep pairs of RI together. 215LB30a.1: RI CM* RI ÷ [^BK CR LF NL SP ZW WJ CL CP EX IS SY GL QU BA HY NS IN CM]; 216LB30a.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]; 217LB30a.3: RI CM* RI CM* [BK CR LF NL SP ZW WJ GL CL CP EX IS SY QU BA HY NS IN ZWJ]?; 218 219# LB30b Do not break between Emoji Base (or potential emoji) and Emoji Modifier 220LB30b.1: EB CM* EM; 221LB30b.2: ExtPictUnassigned CM* EM; 222 223# LB31 Break Everywhere Else. 224# Include combining marks 225LB31.1: . CM* ZWJ [^CM]; 226LB31.2: . CM* ÷; 227