Files
aho_corasick
atty
beef
bitflags
bstr
byteorder
cfg_if
clap
clap_derive
codespan
codespan_reporting
crc_any
crypto_hash
csv
csv_core
debug_helper
filepath
fixed
fixed_macro
fixed_macro_impl
fixed_macro_types
fnv
foreign_types
foreign_types_shared
getrandom
glob
hashbrown
heck
hex
indexmap
itoa
lazy_static
libc
linked_hash_map
linked_hash_set
logos
logos_derive
lrl_test_compiler
maplit
memchr
memoffset
once_cell
openssl
openssl_sys
os_str_bytes
paste
pest
pest_derive
pest_generator
pest_meta
phf
phf_generator
phf_macros
phf_shared
ppv_lite86
proc_macro2
proc_macro_error
proc_macro_error_attr
proc_macro_hack
quote
rand
rand_chacha
rand_core
regex
regex_automata
regex_syntax
remove_dir_all
ring
rowan
rustc_hash
ryu
semver
semver_parser
serde
serde_derive
serde_json
siphasher
smallvec
smawk
smol_str
spin
stable_deref_trait
strsim
syn
taplo
tempfile
termcolor
text_size
textwrap
toml
triomphe
typenum
ucd_trie
unicode_linebreak
unicode_segmentation
unicode_width
unicode_xid
untrusted
utf8_ranges
vec_map
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/// Unicode line breaking class.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
#[repr(u8)]
pub enum BreakClass {
    // Non-tailorable
    /// Cause a line break (after)
    Mandatory,
    /// Cause a line break (after), except between CR and LF
    CarriageReturn,
    /// Cause a line break (after)
    LineFeed,
    /// Prohibit a line break between the character and the preceding character
    CombiningMark,
    /// Cause a line break (after)
    NextLine,
    /// Do not occur in well-formed text
    Surrogate,
    /// Prohibit line breaks before and after
    WordJoiner,
    /// Provide a break opportunity
    ZeroWidthSpace,
    /// Prohibit line breaks before and after
    NonBreakingGlue,
    /// Enable indirect line breaks
    Space,
    /// Prohibit line breaks within joiner sequences
    ZeroWidthJoiner,
    // Break opportunities
    /// Provide a line break opportunity before and after the character
    BeforeAndAfter,
    /// Generally provide a line break opportunity after the character
    After,
    /// Generally provide a line break opportunity before the character
    Before,
    /// Provide a line break opportunity after the character, except in numeric context
    Hyphen,
    /// Provide a line break opportunity contingent on additional information
    Contingent,
    // Characters prohibiting certain breaks
    /// Prohibit line breaks before
    ClosePunctuation,
    /// Prohibit line breaks before
    CloseParenthesis,
    /// Prohibit line breaks before
    Exclamation,
    /// Allow only indirect line breaks between pairs
    Inseparable,
    /// Allow only indirect line breaks before
    NonStarter,
    /// Prohibit line breaks after
    OpenPunctuation,
    /// Act like they are both opening and closing
    Quotation,
    // Numeric context
    /// Prevent breaks after any and before numeric
    InfixSeparator,
    /// Form numeric expressions for line breaking purposes
    Numeric,
    /// Do not break following a numeric expression
    Postfix,
    /// Do not break in front of a numeric expression
    Prefix,
    /// Prevent a break before, and allow a break after
    Symbol,
    // Other characters
    /// Act like AL when the resolved EAW is N; otherwise, act as ID
    Ambiguous,
    /// Are alphabetic characters or symbols that are used with alphabetic characters
    Alphabetic,
    /// Treat as NS or ID for strict or normal breaking.
    ConditionalJapaneseStarter,
    /// Do not break from following Emoji Modifier
    EmojiBase,
    /// Do not break from preceding Emoji Base
    EmojiModifier,
    /// Form Korean syllable blocks
    HangulLvSyllable,
    /// Form Korean syllable blocks
    HangulLvtSyllable,
    /// Do not break around a following hyphen; otherwise act as Alphabetic
    HebrewLetter,
    /// Break before or after, except in some numeric context
    Ideographic,
    /// Form Korean syllable blocks
    HangulLJamo,
    /// Form Korean syllable blocks
    HangulVJamo,
    /// Form Korean syllable blocks
    HangulTJamo,
    /// Keep pairs together. For pairs, break before and after other classes
    RegionalIndicator,
    /// Provide a line break opportunity contingent on additional, language-specific context analysis
    ComplexContext,
    /// Have as yet unknown line breaking behavior or unassigned code positions
    Unknown,
}

use BreakClass::{
    After as BA, Alphabetic as AL, Ambiguous as AI, Before as BB, BeforeAndAfter as B2,
    CarriageReturn as CR, CloseParenthesis as CP, ClosePunctuation as CL, CombiningMark as CM,
    ComplexContext as SA, ConditionalJapaneseStarter as CJ, Contingent as CB, EmojiBase as EB,
    EmojiModifier as EM, Exclamation as EX, HangulLJamo as JL, HangulLvSyllable as H2,
    HangulLvtSyllable as H3, HangulTJamo as JT, HangulVJamo as JV, HebrewLetter as HL,
    Hyphen as HY, Ideographic as ID, InfixSeparator as IS, Inseparable as IN, LineFeed as LF,
    Mandatory as BK, NextLine as NL, NonBreakingGlue as GL, NonStarter as NS, Numeric as NU,
    OpenPunctuation as OP, Postfix as PO, Prefix as PR, Quotation as QU, RegionalIndicator as RI,
    Space as SP, Surrogate as SG, Symbol as SY, Unknown as XX, WordJoiner as WJ,
    ZeroWidthJoiner as ZWJ, ZeroWidthSpace as ZW,
};

const ALLOWED_BREAK_BIT: u8 = 0x80;
const MANDATORY_BREAK_BIT: u8 = 0x40;
const UNIFORM_PAGE: usize = 0x8000;

#[allow(non_upper_case_globals)]
const eot: u8 = 43;
#[allow(non_upper_case_globals)]
const sot: u8 = 44;