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