monotone

monotone Mtn Source Tree

Root/pcre/pcre_tables.c

1/*************************************************
2* Perl-Compatible Regular Expressions *
3*************************************************/
4
5/* PCRE is a library of functions to support regular expressions whose syntax
6and semantics are as close as possible to those of the Perl 5 language.
7
8 Written by Philip Hazel
9 Copyright (c) 1997-2008 University of Cambridge
10
11-----------------------------------------------------------------------------
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14
15 * Redistributions of source code must retain the above copyright notice,
16 this list of conditions and the following disclaimer.
17
18 * Redistributions in binary form must reproduce the above copyright
19 notice, this list of conditions and the following disclaimer in the
20 documentation and/or other materials provided with the distribution.
21
22 * Neither the name of the University of Cambridge nor the names of its
23 contributors may be used to endorse or promote products derived from
24 this software without specific prior written permission.
25
26THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36POSSIBILITY OF SUCH DAMAGE.
37-----------------------------------------------------------------------------
38*/
39
40
41/* This module contains some fixed tables that are used by more than one of the
42PCRE code modules. The tables are also #included by the pcretest program, which
43uses macros to change their names from _pcre_xxx to xxxx, thereby avoiding name
44clashes with the library. */
45
46
47#include "pcre_config.h"
48
49#include "pcre_internal.h"
50
51
52/* Table of sizes for the fixed-length opcodes. It's defined in a macro so that
53the definition is next to the definition of the opcodes in pcre_internal.h. */
54
55const uschar _pcre_OP_lengths[] = { OP_LENGTHS };
56
57
58
59/*************************************************
60* Tables for UTF-8 support *
61*************************************************/
62
63/* These are the breakpoints for different numbers of bytes in a UTF-8
64character. */
65
66#ifdef SUPPORT_UTF8
67
68const int _pcre_utf8_table1[] =
69 { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
70
71const int _pcre_utf8_table1_size = sizeof(_pcre_utf8_table1)/sizeof(int);
72
73/* These are the indicator bits and the mask for the data bits to set in the
74first byte of a character, indexed by the number of additional bytes. */
75
76const int _pcre_utf8_table2[] = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
77const int _pcre_utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
78
79/* Table of the number of extra bytes, indexed by the first byte masked with
800x3f. The highest number for a valid UTF-8 first byte is in fact 0x3d. */
81
82const uschar _pcre_utf8_table4[] = {
83 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
84 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
85 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
86 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
87
88/* The pcre_utt[] table below translates Unicode property names into type and
89code values. It is searched by binary chop, so must be in collating sequence of
90name. Originally, the table contained pointers to the name strings in the first
91field of each entry. However, that leads to a large number of relocations when
92a shared library is dynamically loaded. A significant reduction is made by
93putting all the names into a single, large string and then using offsets in the
94table itself. Maintenance is more error-prone, but frequent changes to this
95data is unlikely. */
96
97const char _pcre_utt_names[] =
98 "Any\0"
99 "Arabic\0"
100 "Armenian\0"
101 "Balinese\0"
102 "Bengali\0"
103 "Bopomofo\0"
104 "Braille\0"
105 "Buginese\0"
106 "Buhid\0"
107 "C\0"
108 "Canadian_Aboriginal\0"
109 "Cc\0"
110 "Cf\0"
111 "Cherokee\0"
112 "Cn\0"
113 "Co\0"
114 "Common\0"
115 "Coptic\0"
116 "Cs\0"
117 "Cuneiform\0"
118 "Cypriot\0"
119 "Cyrillic\0"
120 "Deseret\0"
121 "Devanagari\0"
122 "Ethiopic\0"
123 "Georgian\0"
124 "Glagolitic\0"
125 "Gothic\0"
126 "Greek\0"
127 "Gujarati\0"
128 "Gurmukhi\0"
129 "Han\0"
130 "Hangul\0"
131 "Hanunoo\0"
132 "Hebrew\0"
133 "Hiragana\0"
134 "Inherited\0"
135 "Kannada\0"
136 "Katakana\0"
137 "Kharoshthi\0"
138 "Khmer\0"
139 "L\0"
140 "L&\0"
141 "Lao\0"
142 "Latin\0"
143 "Limbu\0"
144 "Linear_B\0"
145 "Ll\0"
146 "Lm\0"
147 "Lo\0"
148 "Lt\0"
149 "Lu\0"
150 "M\0"
151 "Malayalam\0"
152 "Mc\0"
153 "Me\0"
154 "Mn\0"
155 "Mongolian\0"
156 "Myanmar\0"
157 "N\0"
158 "Nd\0"
159 "New_Tai_Lue\0"
160 "Nko\0"
161 "Nl\0"
162 "No\0"
163 "Ogham\0"
164 "Old_Italic\0"
165 "Old_Persian\0"
166 "Oriya\0"
167 "Osmanya\0"
168 "P\0"
169 "Pc\0"
170 "Pd\0"
171 "Pe\0"
172 "Pf\0"
173 "Phags_Pa\0"
174 "Phoenician\0"
175 "Pi\0"
176 "Po\0"
177 "Ps\0"
178 "Runic\0"
179 "S\0"
180 "Sc\0"
181 "Shavian\0"
182 "Sinhala\0"
183 "Sk\0"
184 "Sm\0"
185 "So\0"
186 "Syloti_Nagri\0"
187 "Syriac\0"
188 "Tagalog\0"
189 "Tagbanwa\0"
190 "Tai_Le\0"
191 "Tamil\0"
192 "Telugu\0"
193 "Thaana\0"
194 "Thai\0"
195 "Tibetan\0"
196 "Tifinagh\0"
197 "Ugaritic\0"
198 "Yi\0"
199 "Z\0"
200 "Zl\0"
201 "Zp\0"
202 "Zs\0";
203
204const ucp_type_table _pcre_utt[] = {
205 { 0, PT_ANY, 0 },
206 { 4, PT_SC, ucp_Arabic },
207 { 11, PT_SC, ucp_Armenian },
208 { 20, PT_SC, ucp_Balinese },
209 { 29, PT_SC, ucp_Bengali },
210 { 37, PT_SC, ucp_Bopomofo },
211 { 46, PT_SC, ucp_Braille },
212 { 54, PT_SC, ucp_Buginese },
213 { 63, PT_SC, ucp_Buhid },
214 { 69, PT_GC, ucp_C },
215 { 71, PT_SC, ucp_Canadian_Aboriginal },
216 { 91, PT_PC, ucp_Cc },
217 { 94, PT_PC, ucp_Cf },
218 { 97, PT_SC, ucp_Cherokee },
219 { 106, PT_PC, ucp_Cn },
220 { 109, PT_PC, ucp_Co },
221 { 112, PT_SC, ucp_Common },
222 { 119, PT_SC, ucp_Coptic },
223 { 126, PT_PC, ucp_Cs },
224 { 129, PT_SC, ucp_Cuneiform },
225 { 139, PT_SC, ucp_Cypriot },
226 { 147, PT_SC, ucp_Cyrillic },
227 { 156, PT_SC, ucp_Deseret },
228 { 164, PT_SC, ucp_Devanagari },
229 { 175, PT_SC, ucp_Ethiopic },
230 { 184, PT_SC, ucp_Georgian },
231 { 193, PT_SC, ucp_Glagolitic },
232 { 204, PT_SC, ucp_Gothic },
233 { 211, PT_SC, ucp_Greek },
234 { 217, PT_SC, ucp_Gujarati },
235 { 226, PT_SC, ucp_Gurmukhi },
236 { 235, PT_SC, ucp_Han },
237 { 239, PT_SC, ucp_Hangul },
238 { 246, PT_SC, ucp_Hanunoo },
239 { 254, PT_SC, ucp_Hebrew },
240 { 261, PT_SC, ucp_Hiragana },
241 { 270, PT_SC, ucp_Inherited },
242 { 280, PT_SC, ucp_Kannada },
243 { 288, PT_SC, ucp_Katakana },
244 { 297, PT_SC, ucp_Kharoshthi },
245 { 308, PT_SC, ucp_Khmer },
246 { 314, PT_GC, ucp_L },
247 { 316, PT_LAMP, 0 },
248 { 319, PT_SC, ucp_Lao },
249 { 323, PT_SC, ucp_Latin },
250 { 329, PT_SC, ucp_Limbu },
251 { 335, PT_SC, ucp_Linear_B },
252 { 344, PT_PC, ucp_Ll },
253 { 347, PT_PC, ucp_Lm },
254 { 350, PT_PC, ucp_Lo },
255 { 353, PT_PC, ucp_Lt },
256 { 356, PT_PC, ucp_Lu },
257 { 359, PT_GC, ucp_M },
258 { 361, PT_SC, ucp_Malayalam },
259 { 371, PT_PC, ucp_Mc },
260 { 374, PT_PC, ucp_Me },
261 { 377, PT_PC, ucp_Mn },
262 { 380, PT_SC, ucp_Mongolian },
263 { 390, PT_SC, ucp_Myanmar },
264 { 398, PT_GC, ucp_N },
265 { 400, PT_PC, ucp_Nd },
266 { 403, PT_SC, ucp_New_Tai_Lue },
267 { 415, PT_SC, ucp_Nko },
268 { 419, PT_PC, ucp_Nl },
269 { 422, PT_PC, ucp_No },
270 { 425, PT_SC, ucp_Ogham },
271 { 431, PT_SC, ucp_Old_Italic },
272 { 442, PT_SC, ucp_Old_Persian },
273 { 454, PT_SC, ucp_Oriya },
274 { 460, PT_SC, ucp_Osmanya },
275 { 468, PT_GC, ucp_P },
276 { 470, PT_PC, ucp_Pc },
277 { 473, PT_PC, ucp_Pd },
278 { 476, PT_PC, ucp_Pe },
279 { 479, PT_PC, ucp_Pf },
280 { 482, PT_SC, ucp_Phags_Pa },
281 { 491, PT_SC, ucp_Phoenician },
282 { 502, PT_PC, ucp_Pi },
283 { 505, PT_PC, ucp_Po },
284 { 508, PT_PC, ucp_Ps },
285 { 511, PT_SC, ucp_Runic },
286 { 517, PT_GC, ucp_S },
287 { 519, PT_PC, ucp_Sc },
288 { 522, PT_SC, ucp_Shavian },
289 { 530, PT_SC, ucp_Sinhala },
290 { 538, PT_PC, ucp_Sk },
291 { 541, PT_PC, ucp_Sm },
292 { 544, PT_PC, ucp_So },
293 { 547, PT_SC, ucp_Syloti_Nagri },
294 { 560, PT_SC, ucp_Syriac },
295 { 567, PT_SC, ucp_Tagalog },
296 { 575, PT_SC, ucp_Tagbanwa },
297 { 584, PT_SC, ucp_Tai_Le },
298 { 591, PT_SC, ucp_Tamil },
299 { 597, PT_SC, ucp_Telugu },
300 { 604, PT_SC, ucp_Thaana },
301 { 611, PT_SC, ucp_Thai },
302 { 616, PT_SC, ucp_Tibetan },
303 { 624, PT_SC, ucp_Tifinagh },
304 { 633, PT_SC, ucp_Ugaritic },
305 { 642, PT_SC, ucp_Yi },
306 { 645, PT_GC, ucp_Z },
307 { 647, PT_PC, ucp_Zl },
308 { 650, PT_PC, ucp_Zp },
309 { 653, PT_PC, ucp_Zs }
310};
311
312const int _pcre_utt_size = sizeof(_pcre_utt)/sizeof(ucp_type_table);
313
314#endif /* SUPPORT_UTF8 */
315
316/* End of pcre_tables.c */

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status