bootstrap-funclib.sh: Restore readability.
[gnulib.git] / lib / uniwbrk / wbrktable.c
blob688fc79666494d4abf306ddf9ede24100cee1ad5
1 /* Word break auxiliary table. -*- coding: utf-8 -*-
2 Copyright (C) 2009-2024 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2009.
5 This file is free software.
6 It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
7 You can redistribute it and/or modify it under either
8 - the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation, either version 3, or (at your
10 option) any later version, or
11 - the terms of the GNU General Public License as published by the
12 Free Software Foundation; either version 2, or (at your option)
13 any later version, or
14 - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+".
16 This file is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License and the GNU General Public License
20 for more details.
22 You should have received a copy of the GNU Lesser General Public
23 License and of the GNU General Public License along with this
24 program. If not, see <https://www.gnu.org/licenses/>. */
26 #include <config.h>
28 /* Specification. */
29 #include "wbrktable.h"
31 const int uniwbrk_prop_index[23] =
33 /* WBP_OTHER */ 0,
34 /* WBP_KATAKANA */ 1,
35 /* WBP_ALETTER */ 2,
36 /* WBP_MIDNUMLET */ 3,
37 /* WBP_MIDLETTER */ 4,
38 /* WBP_MIDNUM */ 5,
39 /* WBP_NUMERIC */ 6,
40 /* WBP_EXTENDNUMLET */ 7,
41 /* WBP_EXTEND */ -1,
42 /* WBP_FORMAT */ -1,
43 /* WBP_NEWLINE */ -1,
44 /* WBP_CR */ -1,
45 /* WBP_LF */ -1,
46 /* WBP_RI */ -1,
47 /* WBP_DQ */ 8,
48 /* WBP_SQ */ 9,
49 /* WBP_HL */ 10,
50 /* WBP_ZWJ */ -1,
51 /* WBP_EB */ -1,
52 /* WBP_EM */ -1,
53 /* WBP_GAZ */ -1,
54 /* WBP_EBG */ -1,
55 /* WBP_WSS */ 11
58 /* This table contains the following rules (see UAX #29):
60 last current
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)
72 Note that the following rules are not handled here but in the loop in u-wordbreaks.h:
73 - The rules need to look back or look ahead the second character (WB6, WB7, WB7b, WB7c, WB11, WB12)
74 - The rules with a higher precedence over the "ignore" rule (WB4), such as WB3c
77 const unsigned char uniwbrk_table[12][12] =
78 { /* current: OTHER MIDNUMLET NUMERIC SQ */
79 /* KATAKANA MIDLETTER EXNUMLET HL */
80 /* ALETTER MIDNUM DQ WSS */
81 /* last */
82 /* WBP_OTHER */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
83 /* WBP_KATAKANA */ { 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 },
84 /* WBP_ALETTER */ { 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1 },
85 /* WBP_MIDNUMLET */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
86 /* WBP_MIDLETTER */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
87 /* WBP_MIDNUM */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
88 /* WBP_NUMERIC */ { 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1 },
89 /* WBP_EXTENDNUMLET */ { 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1 },
90 /* WBP_DQ */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
91 /* WBP_SQ */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
92 /* WBP_HL */ { 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1 },
93 /* WBP_WSS */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }