diff options
Diffstat (limited to 'src/text_processing/types.rs')
-rw-r--r-- | src/text_processing/types.rs | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/src/text_processing/types.rs b/src/text_processing/types.rs new file mode 100644 index 0000000..47961ac --- /dev/null +++ b/src/text_processing/types.rs @@ -0,0 +1,123 @@ +/* + * bb + * + * Copyright 2019 Manos Pitsidianakis + * + * This file is part of bb. + * + * bb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * bb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with bb. If not, see <http://www.gnu.org/licenses/>. + */ + +#[derive(Debug, Copy, Clone, PartialEq)] +pub enum LineBreakClass { + BK, + CM, + CR, + GL, + LF, + NL, + SP, + WJ, + ZW, + ZWJ, + AI, + AL, + B2, + BA, + BB, + CB, + CJ, + CL, + CP, + EB, + EM, + EX, + H2, + H3, + HL, + HY, + ID, + IN, + IS, + JL, + JT, + JV, + NS, + NU, + OP, + PO, + PR, + QU, + RI, + SA, + SG, + SY, + XX, +} + +use LineBreakClass::*; + +impl From<&str> for LineBreakClass { + fn from(val: &str) -> Self { + match val { + stringify!(BK) => BK, + stringify!(CM) => CM, + stringify!(CR) => CR, + stringify!(GL) => GL, + stringify!(LF) => LF, + stringify!(NL) => NL, + stringify!(SP) => SP, + stringify!(WJ) => WJ, + stringify!(ZW) => ZW, + stringify!(ZWJ) => ZWJ, + stringify!(AI) => AI, + stringify!(AL) => AL, + stringify!(B2) => B2, + stringify!(BA) => BA, + stringify!(BB) => BB, + stringify!(CB) => CB, + stringify!(CJ) => CJ, + stringify!(CL) => CL, + stringify!(CP) => CP, + stringify!(EB) => EB, + + stringify!(EM) => EM, + stringify!(EX) => EX, + stringify!(H2) => H2, + stringify!(H3) => H3, + stringify!(HL) => HL, + stringify!(HY) => HY, + stringify!(ID) => ID, + stringify!(IN) => IN, + stringify!(IS) => IS, + stringify!(JL) => JL, + + stringify!(JT) => JT, + stringify!(JV) => JV, + stringify!(NS) => NS, + stringify!(NU) => NU, + stringify!(OP) => OP, + stringify!(PO) => PO, + stringify!(PR) => PR, + stringify!(QU) => QU, + stringify!(RI) => RI, + stringify!(SA) => SA, + + stringify!(SG) => SG, + stringify!(SY) => SY, + stringify!(XX) => XX, + _ => unreachable!(), + } + } +} |