1 /* Word break auxiliary table. -*- coding: utf-8 -*- 2 Copyright (C) 2009-2018 Free Software Foundation, Inc. 3 Written by Bruno Haible <bruno@clisp.org>, 2009. 4 5 This program is free software: you can redistribute it and/or 6 modify it under the terms of either: 7 8 * the GNU Lesser General Public License as published by the Free 9 Software Foundation; either version 3 of the License, or (at your 10 option) any later version. 11 12 or 13 14 * the GNU General Public License as published by the Free 15 Software Foundation; either version 2 of the License, or (at your 16 option) any later version. 17 18 or both in parallel, as here. 19 This program is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 Lesser General Public License for more details. 23 24 You should have received a copy of the GNU Lesser General Public License 25 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 26 27 #include <config.h> 28 29 /* Specification. */ 30 #include "wbrktable.h" 31 32 const int uniwbrk_prop_index[22] = 33 { 34 0, /* WBP_OTHER */ 35 1, /* WBP_KATAKANA */ 36 2, /* WBP_ALETTER */ 37 3, /* WBP_MIDNUMLET */ 38 4, /* WBP_MIDLETTER */ 39 5, /* WBP_MIDNUM */ 40 6, /* WBP_NUMERIC */ 41 7, /* WBP_EXTENDNUMLET */ 42 -1, /* WBP_EXTEND */ 43 -1, /* WBP_FORMAT */ 44 -1, /* WBP_NEWLINE */ 45 -1, /* WBP_CR */ 46 -1, /* WBP_LF */ 47 -1, /* WBP_RI */ 48 8, /* WBP_DQ */ 49 9, /* WBP_SQ */ 50 10, /* WBP_HL */ 51 -1, /* WBP_ZWJ */ 52 11, /* WBP_EB */ 53 12, /* WBP_EM */ 54 -1, /* WBP_GAZ */ 55 13 /* WBP_EBG */ 56 }; 57 58 /* This table contains the following rules (see UAX #29): 59 60 last current 61 62 (ALetter | HL) × (ALetter | HL) (WB5) 63 (ALetter | HL) × Numeric (WB9) 64 HL × SQ (WB7a) 65 Numeric × (ALetter | HL) (WB10) 66 Numeric × Numeric (WB8) 67 Katakana × Katakana (WB13) 68 (ALetter | HL | Numeric | Katakana) × ExtendNumLet (WB13a) 69 ExtendNumLet × ExtendNumLet (WB13a) 70 ExtendNumLet × (ALetter | HL | Numeric | Katakana) (WB13b) 71 (E_Base | EBG) × E_Modifier (WB14) 72 73 Note that the following rules are not handled here but in the loop in u-wordbreaks.h: 74 - The rules need to look back or look ahead the second character (WB6, WB7, WB7b, WB7c, WB11, WB12) 75 - The rules with a higher precedence over the "ignore" rule (WB4), such as WB3c 76 */ 77 78 const unsigned char uniwbrk_table[14][14] = 79 { /* current: OTHER MIDNUMLET NUMERIC SQ EM */ 80 /* KATAKANA MIDLETTER EXNUMLET HL EBG */ 81 /* ALETTER MIDNUM DQ EB */ 82 /* last */ 83 /* WBP_OTHER */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, 84 /* WBP_KATAKANA */ { 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 }, 85 /* WBP_ALETTER */ { 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1 }, 86 /* WBP_MIDNUMLET */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, 87 /* WBP_MIDLETTER */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, 88 /* WBP_MIDNUM */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, 89 /* WBP_NUMERIC */ { 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1 }, 90 /* WBP_EXTENDNUMLET */ { 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1 }, 91 /* WBP_DQ */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, 92 /* WBP_SQ */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, 93 /* WBP_HL */ { 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1 }, 94 /* WBP_EB */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1 }, 95 /* WBP_EM */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, 96 /* WBP_EBG */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1 } 97 }; 98