1 |
/*************************************************
|
2 |
* Perl-Compatible Regular Expressions *
|
3 |
*************************************************/
|
4 |
|
5 |
/* PCRE is a library of functions to support regular expressions whose syntax
|
6 |
and semantics are as close as possible to those of the Perl 5 language.
|
7 |
|
8 |
Written by Philip Hazel
|
9 |
Copyright (c) 1997-2007 University of Cambridge
|
10 |
|
11 |
-----------------------------------------------------------------------------
|
12 |
Redistribution and use in source and binary forms, with or without
|
13 |
modification, 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 |
|
26 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
27 |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
28 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
29 |
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
30 |
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
31 |
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
32 |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
33 |
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
34 |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
35 |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
36 |
POSSIBILITY OF SUCH DAMAGE.
|
37 |
-----------------------------------------------------------------------------
|
38 |
*/
|
39 |
|
40 |
|
41 |
/* This module contains some fixed tables that are used by more than one of the
|
42 |
PCRE code modules. The tables are also #included by the pcretest program, which
|
43 |
uses macros to change their names from _pcre_xxx to xxxx, thereby avoiding name
|
44 |
clashes with the library. */
|
45 |
|
46 |
|
47 |
#ifdef HAVE_CONFIG_H
|
48 |
#include "config.h"
|
49 |
#endif
|
50 |
|
51 |
#include "pcre_internal.h"
|
52 |
|
53 |
|
54 |
/* Table of sizes for the fixed-length opcodes. It's defined in a macro so that
|
55 |
the definition is next to the definition of the opcodes in pcre_internal.h. */
|
56 |
|
57 |
const uschar _pcre_OP_lengths[] = { OP_LENGTHS };
|
58 |
|
59 |
|
60 |
|
61 |
/*************************************************
|
62 |
* Tables for UTF-8 support *
|
63 |
*************************************************/
|
64 |
|
65 |
/* These are the breakpoints for different numbers of bytes in a UTF-8
|
66 |
character. */
|
67 |
|
68 |
#ifdef SUPPORT_UTF8
|
69 |
|
70 |
const int _pcre_utf8_table1[] =
|
71 |
{ 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
|
72 |
|
73 |
const int _pcre_utf8_table1_size = sizeof(_pcre_utf8_table1)/sizeof(int);
|
74 |
|
75 |
/* These are the indicator bits and the mask for the data bits to set in the
|
76 |
first byte of a character, indexed by the number of additional bytes. */
|
77 |
|
78 |
const int _pcre_utf8_table2[] = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
|
79 |
const int _pcre_utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
|
80 |
|
81 |
/* Table of the number of extra bytes, indexed by the first byte masked with
|
82 |
0x3f. The highest number for a valid UTF-8 first byte is in fact 0x3d. */
|
83 |
|
84 |
const uschar _pcre_utf8_table4[] = {
|
85 |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
86 |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
87 |
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
88 |
3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
|
89 |
|
90 |
/* This table translates Unicode property names into type and code values. It
|
91 |
is searched by binary chop, so must be in collating sequence of name. */
|
92 |
|
93 |
const ucp_type_table _pcre_utt[] = {
|
94 |
{ "Any", PT_ANY, 0 },
|
95 |
{ "Arabic", PT_SC, ucp_Arabic },
|
96 |
{ "Armenian", PT_SC, ucp_Armenian },
|
97 |
{ "Balinese", PT_SC, ucp_Balinese },
|
98 |
{ "Bengali", PT_SC, ucp_Bengali },
|
99 |
{ "Bopomofo", PT_SC, ucp_Bopomofo },
|
100 |
{ "Braille", PT_SC, ucp_Braille },
|
101 |
{ "Buginese", PT_SC, ucp_Buginese },
|
102 |
{ "Buhid", PT_SC, ucp_Buhid },
|
103 |
{ "C", PT_GC, ucp_C },
|
104 |
{ "Canadian_Aboriginal", PT_SC, ucp_Canadian_Aboriginal },
|
105 |
{ "Cc", PT_PC, ucp_Cc },
|
106 |
{ "Cf", PT_PC, ucp_Cf },
|
107 |
{ "Cherokee", PT_SC, ucp_Cherokee },
|
108 |
{ "Cn", PT_PC, ucp_Cn },
|
109 |
{ "Co", PT_PC, ucp_Co },
|
110 |
{ "Common", PT_SC, ucp_Common },
|
111 |
{ "Coptic", PT_SC, ucp_Coptic },
|
112 |
{ "Cs", PT_PC, ucp_Cs },
|
113 |
{ "Cuneiform", PT_SC, ucp_Cuneiform },
|
114 |
{ "Cypriot", PT_SC, ucp_Cypriot },
|
115 |
{ "Cyrillic", PT_SC, ucp_Cyrillic },
|
116 |
{ "Deseret", PT_SC, ucp_Deseret },
|
117 |
{ "Devanagari", PT_SC, ucp_Devanagari },
|
118 |
{ "Ethiopic", PT_SC, ucp_Ethiopic },
|
119 |
{ "Georgian", PT_SC, ucp_Georgian },
|
120 |
{ "Glagolitic", PT_SC, ucp_Glagolitic },
|
121 |
{ "Gothic", PT_SC, ucp_Gothic },
|
122 |
{ "Greek", PT_SC, ucp_Greek },
|
123 |
{ "Gujarati", PT_SC, ucp_Gujarati },
|
124 |
{ "Gurmukhi", PT_SC, ucp_Gurmukhi },
|
125 |
{ "Han", PT_SC, ucp_Han },
|
126 |
{ "Hangul", PT_SC, ucp_Hangul },
|
127 |
{ "Hanunoo", PT_SC, ucp_Hanunoo },
|
128 |
{ "Hebrew", PT_SC, ucp_Hebrew },
|
129 |
{ "Hiragana", PT_SC, ucp_Hiragana },
|
130 |
{ "Inherited", PT_SC, ucp_Inherited },
|
131 |
{ "Kannada", PT_SC, ucp_Kannada },
|
132 |
{ "Katakana", PT_SC, ucp_Katakana },
|
133 |
{ "Kharoshthi", PT_SC, ucp_Kharoshthi },
|
134 |
{ "Khmer", PT_SC, ucp_Khmer },
|
135 |
{ "L", PT_GC, ucp_L },
|
136 |
{ "L&", PT_LAMP, 0 },
|
137 |
{ "Lao", PT_SC, ucp_Lao },
|
138 |
{ "Latin", PT_SC, ucp_Latin },
|
139 |
{ "Limbu", PT_SC, ucp_Limbu },
|
140 |
{ "Linear_B", PT_SC, ucp_Linear_B },
|
141 |
{ "Ll", PT_PC, ucp_Ll },
|
142 |
{ "Lm", PT_PC, ucp_Lm },
|
143 |
{ "Lo", PT_PC, ucp_Lo },
|
144 |
{ "Lt", PT_PC, ucp_Lt },
|
145 |
{ "Lu", PT_PC, ucp_Lu },
|
146 |
{ "M", PT_GC, ucp_M },
|
147 |
{ "Malayalam", PT_SC, ucp_Malayalam },
|
148 |
{ "Mc", PT_PC, ucp_Mc },
|
149 |
{ "Me", PT_PC, ucp_Me },
|
150 |
{ "Mn", PT_PC, ucp_Mn },
|
151 |
{ "Mongolian", PT_SC, ucp_Mongolian },
|
152 |
{ "Myanmar", PT_SC, ucp_Myanmar },
|
153 |
{ "N", PT_GC, ucp_N },
|
154 |
{ "Nd", PT_PC, ucp_Nd },
|
155 |
{ "New_Tai_Lue", PT_SC, ucp_New_Tai_Lue },
|
156 |
{ "Nko", PT_SC, ucp_Nko },
|
157 |
{ "Nl", PT_PC, ucp_Nl },
|
158 |
{ "No", PT_PC, ucp_No },
|
159 |
{ "Ogham", PT_SC, ucp_Ogham },
|
160 |
{ "Old_Italic", PT_SC, ucp_Old_Italic },
|
161 |
{ "Old_Persian", PT_SC, ucp_Old_Persian },
|
162 |
{ "Oriya", PT_SC, ucp_Oriya },
|
163 |
{ "Osmanya", PT_SC, ucp_Osmanya },
|
164 |
{ "P", PT_GC, ucp_P },
|
165 |
{ "Pc", PT_PC, ucp_Pc },
|
166 |
{ "Pd", PT_PC, ucp_Pd },
|
167 |
{ "Pe", PT_PC, ucp_Pe },
|
168 |
{ "Pf", PT_PC, ucp_Pf },
|
169 |
{ "Phags_Pa", PT_SC, ucp_Phags_Pa },
|
170 |
{ "Phoenician", PT_SC, ucp_Phoenician },
|
171 |
{ "Pi", PT_PC, ucp_Pi },
|
172 |
{ "Po", PT_PC, ucp_Po },
|
173 |
{ "Ps", PT_PC, ucp_Ps },
|
174 |
{ "Runic", PT_SC, ucp_Runic },
|
175 |
{ "S", PT_GC, ucp_S },
|
176 |
{ "Sc", PT_PC, ucp_Sc },
|
177 |
{ "Shavian", PT_SC, ucp_Shavian },
|
178 |
{ "Sinhala", PT_SC, ucp_Sinhala },
|
179 |
{ "Sk", PT_PC, ucp_Sk },
|
180 |
{ "Sm", PT_PC, ucp_Sm },
|
181 |
{ "So", PT_PC, ucp_So },
|
182 |
{ "Syloti_Nagri", PT_SC, ucp_Syloti_Nagri },
|
183 |
{ "Syriac", PT_SC, ucp_Syriac },
|
184 |
{ "Tagalog", PT_SC, ucp_Tagalog },
|
185 |
{ "Tagbanwa", PT_SC, ucp_Tagbanwa },
|
186 |
{ "Tai_Le", PT_SC, ucp_Tai_Le },
|
187 |
{ "Tamil", PT_SC, ucp_Tamil },
|
188 |
{ "Telugu", PT_SC, ucp_Telugu },
|
189 |
{ "Thaana", PT_SC, ucp_Thaana },
|
190 |
{ "Thai", PT_SC, ucp_Thai },
|
191 |
{ "Tibetan", PT_SC, ucp_Tibetan },
|
192 |
{ "Tifinagh", PT_SC, ucp_Tifinagh },
|
193 |
{ "Ugaritic", PT_SC, ucp_Ugaritic },
|
194 |
{ "Yi", PT_SC, ucp_Yi },
|
195 |
{ "Z", PT_GC, ucp_Z },
|
196 |
{ "Zl", PT_PC, ucp_Zl },
|
197 |
{ "Zp", PT_PC, ucp_Zp },
|
198 |
{ "Zs", PT_PC, ucp_Zs }
|
199 |
};
|
200 |
|
201 |
const int _pcre_utt_size = sizeof(_pcre_utt)/sizeof(ucp_type_table);
|
202 |
|
203 |
#endif /* SUPPORT_UTF8 */
|
204 |
|
205 |
/* End of pcre_tables.c */
|