#### Rules for Unicode Line Breaking Algorithm.
#### Based on Unicode Standard Annex #14 (UAX#14), Revision 28 (2012-01-17)
#### by Asmus Freytag and Andy Heninger. http://www.unicode.org/reports/tr14/tr14-27.html

### 1 Non-tailorable Line Breaking Rules

## Resolve line breaking classes:

# LB1
Assign a line breaking class to each code point of the input.

## Start and end of text:

# LB2
sot ×

# LB3
! eot

## Mandatory breaks:

# LB4
BK !

# LB5
CR × LF
CR !
LF !
NL !

# LB6
× ( BK | CR | LF | NL )

## Explicit breaks and non-breaks:

# LB7
× SP
× ZW

# LB8
ZW SP* ÷

## Combining marks:

# LB9
Treat X CM* as if it were X. where X is any line break class except  BK, CR, LF, NL, SP, or ZW.

# LB10
Treat any remaining CM as it if were AL.

## Word joiner:

# LB11
× WJ
WJ ×

## Non-breaking characters:

# LB12
GL ×

### 2 Tailorable Line Breaking Rules

## Non-breaking characters:

# LB12a
[^SP BA HY] × GL

## Opening and closing:

# LB13
× CL
× CP
× EX
× IS
× SY

# LB14
OP SP* ×

# LB15
QU SP* × OP

# LB16
CL SP* × NS
CP SP* × NS

# LB17
B2 SP* × B2

## Spaces:

# LB18
SP ÷

## Special case rules:

# LB19
× QU
QU ×

# LB20
÷ CB
CB ÷

# LB21
× BA
× HY
× NS
BB ×

# LB21a
HL (HY | BA) ×

# LB22
(AL | HL) × IN
ID × IN
IN × IN
NU × IN

## Numbers:

# LB23
ID × PO
(AL | HL) × NU
NU × (AL | HL)

# LB24
PR × ID
PR × (AL | HL)
PO × (AL | HL)

# LB25
#CL × PO
#CP × PO
#CL × PR
#CP × PR
#NU × PO
#NU × PR
#PO × OP
#PO × NU
#PR × OP
#PR × NU
#HY × NU
#IS × NU
#NU × NU
#SY × NU

## Korean syllable blocks

# LB26
JL × (JL | JV | H2 | H3)
(JV | H2) × (JV | JT)
(JT | H3) × JT

# LB27
(JL | JV | JT | H2 | H3) × IN
(JL | JV | JT | H2 | H3) × PO
PR × (JL | JV | JT | H2 | H3)

## Finally, join alphabetic letters into words and break everything else. 

# LB28
(AL | HL) × (AL | HL)

# LB29
IS × (AL | HL)

# LB30 
(AL | HL | NU) × OP
CP × (AL | HL | NU)

# LB31
ALL ÷
÷ ALL
