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.txt 7# 8# Reference Line Break rules for intltest rbbi/RBBIMonkeyTest. 9# Rules derived from Unicode Standard Annex #14 Revision 40 for Unicode 11.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# Line Breaking Rules 15# Implement default line breaking as defined by 16# Unicode Standard Annex #14 Revision 34 for Unicode 8.0 17# http://www.unicode.org/reports/tr14/ 18# tailored as noted in 2nd paragraph below. 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 languages other than 26# Chinese & Japanese. 27# It sets characters of class CJ to behave like ID. 28 29 30type = line; 31locale = en@lb=normal; 32 33AI = [:LineBreak = Ambiguous:]; 34AL = [:LineBreak = Alphabetic:]; 35BA = [:LineBreak = Break_After:]; 36HH = [\u2010]; # \u2010 is HYPHEN, default line break is BA. 37BB = [:LineBreak = Break_Before:]; 38BK = [:LineBreak = Mandatory_Break:]; 39B2 = [:LineBreak = Break_Both:]; 40CB = [:LineBreak = Contingent_Break:]; 41CJ = [:LineBreak = Conditional_Japanese_Starter:]; 42CL = [:LineBreak = Close_Punctuation:]; 43CMS = [:LineBreak = Combining_Mark:]; 44CP = [:LineBreak = Close_Parenthesis:]; 45CR = [:LineBreak = Carriage_Return:]; 46EB = [:LineBreak = EB:]; 47EM = [:LineBreak = EM:]; 48EX = [:LineBreak = Exclamation:]; 49GL = [:LineBreak = Glue:]; 50HL = [:LineBreak = Hebrew_Letter:]; 51HY = [:LineBreak = Hyphen:]; 52H2 = [:LineBreak = H2:]; 53H3 = [:LineBreak = H3:]; 54ID = [[:LineBreak = Ideographic:] CJ]; # CSS Normal tailoring: CJ resolves to ID 55IN = [:LineBreak = Inseperable:]; 56IS = [:LineBreak = Infix_Numeric:]; 57JL = [:LineBreak = JL:]; 58JV = [:LineBreak = JV:]; 59JT = [:LineBreak = JT:]; 60LF = [:LineBreak = Line_Feed:]; 61NL = [:LineBreak = Next_Line:]; 62NS = [:LineBreak = Nonstarter:]; 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 78# LB1 - Resolve AI, CB, CJ, SA, SG, and XX into other line breaking classes 79AL = [AL AI SG XX ]; 80dictionary = SA; 81 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. 84CM = [CMS ZWJ]; 85 86LB4: BK ÷; 87LB5: CR LF; 88LB5.1: CR ÷; 89LB5.2: LF ÷; 90LB5.3: NL ÷; 91 92LB6: . (BK | CR | LF | NL); 93LB6.1: [^BK CR LF NL SP ZW] CM* (BK | CR | LF | NL); 94 95# Rules LB14 - LB17. 96# Moved before LB7, because they can match a longer sequence that would also match LB7, 97# for example, the sequence "OP CM SP AL" matches LB14 while the prefix of it, 98# "while only the prefix "OP CM SP" matches LB7.1 99LB14: OP CM* SP* .; 100LB15: QU CM* SP* OP; 101LB16: (CL | CP)CM* SP* NS; 102LB17: B2 CM* SP* B2; 103 104# LB8, break after ZW SP*, precedes LB7 because they will both match the sequences like ZW SP, 105# and LB8 should take precedence. 106 107LB8: ZW SP* ÷ [^ZW SP BK CR LF NL]; 108 109# LB7 Do not break before spaces or zero width space. 110 111LB7.1: [^ZW SP] CM* [SP ZW]; 112LB7.2: [ZW SP] [SP ZW]; 113 114# LB8a 115# ZWJ x 116# Don't match a CM on the right - let other rules pick up CM sequences, where 117# the ZWJ behaves as just another generic CM. 118LB8a: ZWJ [^CM]; 119 120 121# LB9: X CM -> X 122# LB10: Unattached CM -> AL 123 124#LB11: × WJ; 125# WJ × 126 127LB11.1: [^SP] CM* WJ; 128LB11.2: SP WJ; 129LB11.3: WJ CM* [^CM]; 130 131LB12: GL CM* [^CM]; 132 133LB12a: [^SP BA HY] CM* GL; 134 135# LB 13 ICU Tailoring, matches tailoring exmaple 8 from UAX 14. 136# 137# LB13.1 [^SP] CM* [CL CP EX IS SY] # original UAX 14 rule. 138# LB13.2 SP CM* [CL CP EX IS SY] 139 140LB13.1: [^NU SP] CM* [CL CP IS SY]; 141LB13.2: [^SP] CM* EX; 142LB13.2: SP [CL CP EX IS SY]; 143 144 145# LB 14-17 are moved above LB 7. 146 147LB18: SP ÷; 148 149LB19: . CM* QU; 150LB19.1: QU CM* [^CM]; 151 152# LB 20 Break before and after CB. 153# Interaction with LB8a: ZWJ x . is tricky because CM includes ZWJ. 154# ZWJ acts like a CM to the left, combining with CB. 155# ZWJ acts independently to the right, no break after by LB8a. 156LB20.1: . CM* ZWJ CB; 157LB20.2: . CM* ÷ CB; 158 159LB20.3: CB CM* ZWJ [^CM]; 160LB20.4: CB CM* ÷; 161 162# LB 20.09 Don't break between Hyphens and Letters when there is a break preceding the hyphen. 163LB20.09: ^(HY | HH) CM* AL; 164 165# Note: Rule 21a must come before 21 to prevent 21.1 from matching HL BA, then 166# not picking up the continuing match after the BA from 21a. 167LB21a: HL CM* (HY | BA) CM* [^CM CB]; 168 169LB21.1: . CM* [BA HY NS]; 170LB21.2: BB CM* [^CM CB]; 171 172LB21b: SY CM* HL; 173 174LB22.1: (AL | HL | CM) CM* IN; # The CM is from LB10, treat an unattached CM as AL. 175LB22.2: EX CM* IN; 176LB22.3: (ID | EB | EM) CM* IN; 177LB22.4: IN CM* IN; 178LB22.5: NU CM* IN; 179 180LB23.1: (AL | HL | CM) CM* NU; 181LB23.2: NU CM* (AL | HL); 182 183LB23a.1: PR CM* (ID | EB | EM); 184LB23a.2: (ID | EB | EM) CM* PO; 185 186LB24.2: (PR | PO) CM* (AL | HL); 187LB24.3: (AL | HL | CM) CM* (PR | PO); 188 189# Numbers. Equivalent to Tailoring example 8 from UAx 14. 190LB25: ((PR | PO)CM*)? ((OP | HY)CM*)? NU (CM*(NU | SY | IS))* (CM*(CL | CP))? (CM*(PR | PO))?; 191 192LB26.1: JL CM* (JL | JV | H2 | H3); 193LB26.2: (JV | H2) CM* (JV | JT); 194LB26.3: (JT | H3) CM* JT; 195 196LB27.1: (JL | JV | JT | H2 | H3) CM* IN; 197LB27.2: (JL | JV | JT | H2 | H3) CM* PO; 198LB27.3: PR CM* (JL | JV | JT | H2 | H3); 199 200# LB28 Do not break between Alphabetics. 201# Unattached (leading) CM treated as AL. 202LB28: (AL | HL | CM)CM* (AL | HL); 203 204LB29: IS CM* (AL | HL); 205 206# LB30 is adjusted for unattached leading CM being treated as AL. 207LB30.1: (AL | CM | HL | NU) CM* OP; 208LB30.2: CP CM* (AL | HL | NU); 209 210# LB30a keep pairs of RI together. 211LB30a.1: RI CM* RI ÷ [^BK CR LF NL SP ZW WJ CL CP EX IS SY GL QU BA HY NS CM]; 212LB30a.2: RI CM* RI CM* CMS ÷ [^BK CR LF NL SP ZW WJ CL CP EX IS SY GL QU BA HY NS CM]; 213LB30a.3: RI CM* RI CM* [BK CR LF NL SP ZW WJ GL CL CP EX IS SY QU BA HY NS ZWJ]?; 214 215# LB30b Do not break between Emoji Base and Emoji Modifier 216LB30b: EB CM* EM; 217 218# LB31 Break Everywhere Else. 219# Include combining marks 220LB31.1: . CM* ZWJ [^CM]; 221LB31.2: . CM* ÷; 222