rugged 1.9.4 → 1.9.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/CMakeLists.txt +1 -1
  4. data/vendor/libgit2/COPYING +83 -11
  5. data/vendor/libgit2/cmake/SelectRegex.cmake +8 -3
  6. data/vendor/libgit2/deps/pcre2/CMakeLists.txt +110 -0
  7. data/vendor/libgit2/deps/pcre2/LICENCE.md +104 -0
  8. data/vendor/libgit2/deps/pcre2/config.h.in +54 -0
  9. data/vendor/libgit2/deps/pcre2/pcre2.h +1079 -0
  10. data/vendor/libgit2/deps/pcre2/pcre2_auto_possess.c +1416 -0
  11. data/vendor/libgit2/deps/{pcre/pcre_chartables.c → pcre2/pcre2_chartables.c} +41 -47
  12. data/vendor/libgit2/deps/{pcre/pcre_ord2utf8.c → pcre2/pcre2_chkdint.c} +36 -36
  13. data/vendor/libgit2/deps/pcre2/pcre2_compile.c +11345 -0
  14. data/vendor/libgit2/deps/pcre2/pcre2_compile.h +356 -0
  15. data/vendor/libgit2/deps/pcre2/pcre2_compile_cgroup.c +632 -0
  16. data/vendor/libgit2/deps/pcre2/pcre2_compile_class.c +2777 -0
  17. data/vendor/libgit2/deps/pcre2/pcre2_config.c +250 -0
  18. data/vendor/libgit2/deps/pcre2/pcre2_context.c +557 -0
  19. data/vendor/libgit2/deps/pcre2/pcre2_convert.c +1263 -0
  20. data/vendor/libgit2/deps/{pcre/pcre_dfa_exec.c → pcre2/pcre2_dfa_match.c} +1402 -943
  21. data/vendor/libgit2/deps/pcre2/pcre2_error.c +384 -0
  22. data/vendor/libgit2/deps/pcre2/pcre2_extuni.c +159 -0
  23. data/vendor/libgit2/deps/pcre2/pcre2_find_bracket.c +217 -0
  24. data/vendor/libgit2/deps/pcre2/pcre2_fuzzsupport.c +844 -0
  25. data/vendor/libgit2/deps/pcre2/pcre2_internal.h +2353 -0
  26. data/vendor/libgit2/deps/pcre2/pcre2_intmodedep.h +1044 -0
  27. data/vendor/libgit2/deps/pcre2/pcre2_maketables.c +177 -0
  28. data/vendor/libgit2/deps/pcre2/pcre2_match.c +8244 -0
  29. data/vendor/libgit2/deps/pcre2/pcre2_match_data.c +184 -0
  30. data/vendor/libgit2/deps/pcre2/pcre2_match_next.c +171 -0
  31. data/vendor/libgit2/deps/{pcre/pcre_newline.c → pcre2/pcre2_newline.c} +92 -63
  32. data/vendor/libgit2/deps/{pcre/pcre_refcount.c → pcre2/pcre2_ord2utf.c} +64 -38
  33. data/vendor/libgit2/deps/pcre2/pcre2_pattern_info.c +430 -0
  34. data/vendor/libgit2/deps/pcre2/pcre2_printint_inc.h +1098 -0
  35. data/vendor/libgit2/deps/pcre2/pcre2_script_run.c +344 -0
  36. data/vendor/libgit2/deps/pcre2/pcre2_serialize.c +284 -0
  37. data/vendor/libgit2/deps/pcre2/pcre2_string_utils.c +199 -0
  38. data/vendor/libgit2/deps/pcre2/pcre2_study.c +2087 -0
  39. data/vendor/libgit2/deps/pcre2/pcre2_substitute.c +1761 -0
  40. data/vendor/libgit2/deps/pcre2/pcre2_substring.c +553 -0
  41. data/vendor/libgit2/deps/pcre2/pcre2_tables.c +310 -0
  42. data/vendor/libgit2/deps/pcre2/pcre2_ucd.c +5805 -0
  43. data/vendor/libgit2/deps/pcre2/pcre2_ucp.h +408 -0
  44. data/vendor/libgit2/deps/pcre2/pcre2_ucptables_inc.h +1596 -0
  45. data/vendor/libgit2/deps/pcre2/pcre2_util.h +179 -0
  46. data/vendor/libgit2/deps/pcre2/pcre2_valid_utf.c +397 -0
  47. data/vendor/libgit2/deps/pcre2/pcre2_xclass.c +547 -0
  48. data/vendor/libgit2/include/git2/common.h +13 -1
  49. data/vendor/libgit2/include/git2/version.h +2 -2
  50. data/vendor/libgit2/src/libgit2/blame.c +6 -0
  51. data/vendor/libgit2/src/libgit2/delta.c +8 -0
  52. data/vendor/libgit2/src/libgit2/indexer.c +3 -2
  53. data/vendor/libgit2/src/libgit2/settings.c +9 -0
  54. data/vendor/libgit2/src/libgit2/streams/openssl.c +4 -1
  55. data/vendor/libgit2/src/libgit2/submodule.c +77 -12
  56. data/vendor/libgit2/src/libgit2/transports/http.c +4 -4
  57. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +2 -1
  58. data/vendor/libgit2/src/util/fs_path.h +10 -10
  59. data/vendor/libgit2/src/util/regexp.c +27 -12
  60. data/vendor/libgit2/src/util/regexp.h +7 -2
  61. metadata +44 -37
  62. data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
  63. data/vendor/libgit2/deps/pcre/COPYING +0 -5
  64. data/vendor/libgit2/deps/pcre/LICENCE +0 -93
  65. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
  66. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
  67. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
  68. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
  69. data/vendor/libgit2/deps/pcre/config.h.in +0 -57
  70. data/vendor/libgit2/deps/pcre/pcre.h +0 -641
  71. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
  72. data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9815
  73. data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
  74. data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
  75. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
  76. data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
  77. data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
  78. data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
  79. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
  80. data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
  81. data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
  82. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
  83. data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
  84. data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
  85. data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
  86. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
  87. data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
  88. data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
  89. data/vendor/libgit2/deps/pcre/pcreposix.c +0 -420
  90. data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
  91. data/vendor/libgit2/deps/pcre/ucp.h +0 -224
@@ -0,0 +1,384 @@
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
+ Original API code Copyright (c) 1997-2012 University of Cambridge
10
+ New API code Copyright (c) 2016-2024 University of Cambridge
11
+
12
+ -----------------------------------------------------------------------------
13
+ Redistribution and use in source and binary forms, with or without
14
+ modification, are permitted provided that the following conditions are met:
15
+
16
+ * Redistributions of source code must retain the above copyright notice,
17
+ this list of conditions and the following disclaimer.
18
+
19
+ * Redistributions in binary form must reproduce the above copyright
20
+ notice, this list of conditions and the following disclaimer in the
21
+ documentation and/or other materials provided with the distribution.
22
+
23
+ * Neither the name of the University of Cambridge nor the names of its
24
+ contributors may be used to endorse or promote products derived from
25
+ this software without specific prior written permission.
26
+
27
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37
+ POSSIBILITY OF SUCH DAMAGE.
38
+ -----------------------------------------------------------------------------
39
+ */
40
+
41
+
42
+ #include "pcre2_internal.h"
43
+
44
+
45
+
46
+ #define STRING(a) # a
47
+ #define XSTRING(s) STRING(s)
48
+
49
+ /* The texts of compile-time error messages. Compile-time error numbers start
50
+ at COMPILE_ERROR_BASE (100).
51
+
52
+ This used to be a table of strings, but in order to reduce the number of
53
+ relocations needed when a shared library is loaded dynamically, it is now one
54
+ long string. We cannot use a table of offsets, because the lengths of inserts
55
+ such as XSTRING(MAX_NAME_SIZE) are not known. Instead,
56
+ pcre2_get_error_message() counts through to the one it wants - this isn't a
57
+ performance issue because these strings are used only when there is an error.
58
+
59
+ Each substring ends with \0 to insert a null character. This includes the final
60
+ substring, so that the whole string ends with \0\0, which can be detected when
61
+ counting through. */
62
+
63
+ static const unsigned char compile_error_texts[] =
64
+ "no error\0"
65
+ "\\ at end of pattern\0"
66
+ "\\c at end of pattern\0"
67
+ "unrecognized character follows \\\0"
68
+ "numbers out of order in {} quantifier\0"
69
+ /* 5 */
70
+ "number too big in {} quantifier\0"
71
+ "missing terminating ] for character class\0"
72
+ "escape sequence is invalid in character class\0"
73
+ "range out of order in character class\0"
74
+ "quantifier does not follow a repeatable item\0"
75
+ /* 10 */
76
+ "internal error: unexpected repeat\0"
77
+ "unrecognized character after (? or (?-\0"
78
+ "POSIX named classes are supported only within a class\0"
79
+ "POSIX collating elements are not supported\0"
80
+ "missing closing parenthesis\0"
81
+ /* 15 */
82
+ "reference to non-existent subpattern\0"
83
+ "pattern passed as NULL with non-zero length\0"
84
+ "unrecognised compile-time option bit(s)\0"
85
+ "missing ) after (?# comment\0"
86
+ "parentheses are too deeply nested\0"
87
+ /* 20 */
88
+ "regular expression is too large\0"
89
+ "failed to allocate heap memory\0"
90
+ "unmatched closing parenthesis\0"
91
+ "internal error: code overflow\0"
92
+ "missing closing parenthesis for condition\0"
93
+ /* 25 */
94
+ "length of lookbehind assertion is not limited\0"
95
+ "a relative value of zero is not allowed\0"
96
+ "conditional subpattern contains more than two branches\0"
97
+ "atomic assertion expected after (?( or (?(?C)\0"
98
+ "digit expected after (?+\0"
99
+ /* 30 */
100
+ "unknown POSIX class name\0"
101
+ "internal error in pcre2_study(): should not occur\0"
102
+ "this version of PCRE2 does not have Unicode support\0"
103
+ "parentheses are too deeply nested (stack check)\0"
104
+ "character code point value in \\x{} or \\o{} is too large\0"
105
+ /* 35 */
106
+ "lookbehind is too complicated\0"
107
+ "\\C is not allowed in a lookbehind assertion in UTF-" XSTRING(PCRE2_CODE_UNIT_WIDTH) " mode\0"
108
+ "PCRE2 does not support \\F, \\L, \\l, \\N{name}, \\U, or \\u\0"
109
+ "number after (?C is greater than 255\0"
110
+ "closing parenthesis for (?C expected\0"
111
+ /* 40 */
112
+ "invalid escape sequence in (*VERB) name\0"
113
+ "unrecognized character after (?P\0"
114
+ "syntax error in subpattern name (missing terminator?)\0"
115
+ "two named subpatterns have the same name (PCRE2_DUPNAMES not set)\0"
116
+ "subpattern name must start with a non-digit\0"
117
+ /* 45 */
118
+ "this version of PCRE2 does not have support for \\P, \\p, or \\X\0"
119
+ "malformed \\P or \\p sequence\0"
120
+ "unknown property after \\P or \\p\0"
121
+ "subpattern name is too long (maximum " XSTRING(MAX_NAME_SIZE) " code units)\0"
122
+ "too many named subpatterns (maximum " XSTRING(MAX_NAME_COUNT) ")\0"
123
+ /* 50 */
124
+ "invalid range in character class\0"
125
+ "octal value is greater than \\377 in 8-bit non-UTF-8 mode\0"
126
+ "internal error: overran compiling workspace\0"
127
+ "internal error: previously-checked referenced subpattern not found\0"
128
+ "DEFINE subpattern contains more than one branch\0"
129
+ /* 55 */
130
+ "missing opening brace after \\o\0"
131
+ "internal error: unknown newline setting\0"
132
+ "\\g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number\0"
133
+ "(?R (recursive pattern call) must be followed by a closing parenthesis\0"
134
+ /* "an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT)\0" */
135
+ "obsolete error (should not occur)\0" /* Was the above */
136
+ /* 60 */
137
+ "(*VERB) not recognized or malformed\0"
138
+ "subpattern number is too big\0"
139
+ "subpattern name expected\0"
140
+ "internal error: parsed pattern overflow\0"
141
+ "non-octal character in \\o{} (closing brace missing?)\0"
142
+ /* 65 */
143
+ "different names for subpatterns of the same number are not allowed\0"
144
+ "(*MARK) must have an argument\0"
145
+ "non-hex character in \\x{} (closing brace missing?)\0"
146
+ #ifndef EBCDIC
147
+ "\\c must be followed by a printable ASCII character\0"
148
+ #else
149
+ "\\c must be followed by a letter or one of @[\\]^_?\0"
150
+ #endif
151
+ "\\k is not followed by a braced, angle-bracketed, or quoted name\0"
152
+ /* 70 */
153
+ "internal error: unknown meta code in check_lookbehinds()\0"
154
+ "\\N is not supported in a class\0"
155
+ "callout string is too long\0"
156
+ "disallowed Unicode code point (>= 0xd800 && <= 0xdfff)\0"
157
+ "using UTF is disabled by the application\0"
158
+ /* 75 */
159
+ "using UCP is disabled by the application\0"
160
+ "name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)\0"
161
+ "character code point value in \\u.... sequence is too large\0"
162
+ "digits missing after \\x or in \\x{} or \\o{} or \\N{U+}\0"
163
+ "syntax error or number too big in (?(VERSION condition\0"
164
+ /* 80 */
165
+ "internal error: unknown opcode in auto_possessify()\0"
166
+ "missing terminating delimiter for callout with string argument\0"
167
+ "unrecognized string delimiter follows (?C\0"
168
+ "using \\C is disabled by the application\0"
169
+ "(?| and/or (?J: or (?x: parentheses are too deeply nested\0"
170
+ /* 85 */
171
+ "using \\C is disabled in this PCRE2 library\0"
172
+ "regular expression is too complicated\0"
173
+ "lookbehind assertion is too long\0"
174
+ "pattern string is longer than the limit set by the application\0"
175
+ "internal error: unknown code in parsed pattern\0"
176
+ /* 90 */
177
+ "internal error: bad code value in parsed_skip()\0"
178
+ "PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES is not allowed in UTF-16 mode\0"
179
+ "invalid option bits with PCRE2_LITERAL\0"
180
+ "\\N{U+dddd} is supported only in Unicode (UTF) mode\0"
181
+ "invalid hyphen in option setting\0"
182
+ /* 95 */
183
+ "(*alpha_assertion) not recognized\0"
184
+ "script runs require Unicode support, which this version of PCRE2 does not have\0"
185
+ "too many capturing groups (maximum 65535)\0"
186
+ "octal digit missing after \\0 (PCRE2_EXTRA_NO_BS0 is set)\0"
187
+ "\\K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)\0"
188
+ /* 100 */
189
+ "branch too long in variable-length lookbehind assertion\0"
190
+ "compiled pattern would be longer than the limit set by the application\0"
191
+ "octal value given by \\ddd is greater than \\377 (forbidden by PCRE2_EXTRA_PYTHON_OCTAL)\0"
192
+ "using callouts is disabled by the application\0"
193
+ "PCRE2_EXTRA_TURKISH_CASING require Unicode (UTF or UCP) mode\0"
194
+ /* 105 */
195
+ "PCRE2_EXTRA_TURKISH_CASING requires UTF in 8-bit mode\0"
196
+ "PCRE2_EXTRA_TURKISH_CASING and PCRE2_EXTRA_CASELESS_RESTRICT are not compatible\0"
197
+ "extended character class nesting is too deep\0"
198
+ "invalid operator in extended character class\0"
199
+ "unexpected operator in extended character class (no preceding operand)\0"
200
+ /* 110 */
201
+ "expected operand after operator in extended character class\0"
202
+ "square brackets needed to clarify operator precedence in extended character class\0"
203
+ "missing terminating ] for extended character class (note '[' must be escaped under PCRE2_ALT_EXTENDED_CLASS)\0"
204
+ "unexpected expression in extended character class (no preceding operator)\0"
205
+ "empty expression in extended character class\0"
206
+ /* 115 */
207
+ "terminating ] with no following closing parenthesis in (?[...]\0"
208
+ "unexpected character in (?[...]) extended character class\0"
209
+ "expected capture group number or name\0"
210
+ "missing opening parenthesis\0"
211
+ "syntax error in subpattern number (missing terminator?)\0"
212
+ /* 120 */
213
+ "erroroffset passed as NULL\0"
214
+ ;
215
+
216
+ /* Match-time and UTF error texts are in the same format. */
217
+
218
+ static const unsigned char match_error_texts[] =
219
+ "no error\0"
220
+ "no match\0"
221
+ "partial match\0"
222
+ "UTF-8 error: 1 byte missing at end\0"
223
+ "UTF-8 error: 2 bytes missing at end\0"
224
+ /* 5 */
225
+ "UTF-8 error: 3 bytes missing at end\0"
226
+ "UTF-8 error: 4 bytes missing at end\0"
227
+ "UTF-8 error: 5 bytes missing at end\0"
228
+ "UTF-8 error: byte 2 top bits not 0x80\0"
229
+ "UTF-8 error: byte 3 top bits not 0x80\0"
230
+ /* 10 */
231
+ "UTF-8 error: byte 4 top bits not 0x80\0"
232
+ "UTF-8 error: byte 5 top bits not 0x80\0"
233
+ "UTF-8 error: byte 6 top bits not 0x80\0"
234
+ "UTF-8 error: 5-byte character is not allowed (RFC 3629)\0"
235
+ "UTF-8 error: 6-byte character is not allowed (RFC 3629)\0"
236
+ /* 15 */
237
+ "UTF-8 error: code points greater than 0x10ffff are not defined\0"
238
+ "UTF-8 error: code points 0xd800-0xdfff are not defined\0"
239
+ "UTF-8 error: overlong 2-byte sequence\0"
240
+ "UTF-8 error: overlong 3-byte sequence\0"
241
+ "UTF-8 error: overlong 4-byte sequence\0"
242
+ /* 20 */
243
+ "UTF-8 error: overlong 5-byte sequence\0"
244
+ "UTF-8 error: overlong 6-byte sequence\0"
245
+ "UTF-8 error: isolated byte with 0x80 bit set\0"
246
+ "UTF-8 error: illegal byte (0xfe or 0xff)\0"
247
+ "UTF-16 error: missing low surrogate at end\0"
248
+ /* 25 */
249
+ "UTF-16 error: invalid low surrogate\0"
250
+ "UTF-16 error: isolated low surrogate\0"
251
+ "UTF-32 error: code points 0xd800-0xdfff are not defined\0"
252
+ "UTF-32 error: code points greater than 0x10ffff are not defined\0"
253
+ "bad data value\0"
254
+ /* 30 */
255
+ "patterns do not all use the same character tables\0"
256
+ "magic number missing\0"
257
+ "pattern compiled in wrong mode: 8/16/32-bit error\0"
258
+ "bad offset value\0"
259
+ "bad option value\0"
260
+ /* 35 */
261
+ "invalid replacement string\0"
262
+ "bad offset into UTF string\0"
263
+ "callout error code\0" /* Never returned by PCRE2 itself */
264
+ "invalid data in workspace for DFA restart\0"
265
+ "too much recursion for DFA matching\0"
266
+ /* 40 */
267
+ "backreference condition or recursion test is not supported for DFA matching\0"
268
+ "function is not supported for DFA matching\0"
269
+ "pattern contains an item that is not supported for DFA matching\0"
270
+ "workspace size exceeded in DFA matching\0"
271
+ "internal error - pattern overwritten?\0"
272
+ /* 45 */
273
+ "bad JIT option\0"
274
+ "JIT stack limit reached\0"
275
+ "match limit exceeded\0"
276
+ "no more memory\0"
277
+ "unknown substring\0"
278
+ /* 50 */
279
+ "non-unique substring name\0"
280
+ "NULL argument passed with non-zero length\0"
281
+ "nested recursion at the same subject position\0"
282
+ "matching depth limit exceeded\0"
283
+ "requested value is not available\0"
284
+ /* 55 */
285
+ "requested value is not set\0"
286
+ "offset limit set without PCRE2_USE_OFFSET_LIMIT\0"
287
+ "bad escape sequence in replacement string\0"
288
+ "expected closing curly bracket in replacement string\0"
289
+ "bad substitution in replacement string\0"
290
+ /* 60 */
291
+ "match with end before start or start moved backwards is not supported\0"
292
+ "too many replacements (more than INT_MAX)\0"
293
+ "bad serialized data\0"
294
+ "heap limit exceeded\0"
295
+ "invalid syntax\0"
296
+ /* 65 */
297
+ "internal error: duplicate substitution match\0"
298
+ "PCRE2_MATCH_INVALID_UTF is not supported for DFA matching\0"
299
+ "internal error: invalid substring offset\0"
300
+ "feature is not supported by the JIT compiler\0"
301
+ "error performing replacement case transformation\0"
302
+ /* 70 */
303
+ "replacement too large (longer than PCRE2_SIZE)\0"
304
+ "substitute pattern differs from prior match call\0"
305
+ "substitute subject differs from prior match call\0"
306
+ "substitute start offset differs from prior match call\0"
307
+ "substitute options differ from prior match call\0"
308
+ "disallowed use of \\K in lookaround\0"
309
+ ;
310
+
311
+
312
+ /*************************************************
313
+ * Return error message *
314
+ *************************************************/
315
+
316
+ /* This function copies an error message into a buffer whose units are of an
317
+ appropriate width. Error numbers are positive for compile-time errors, and
318
+ negative for match-time errors (except for UTF errors), but the numbers are all
319
+ distinct.
320
+
321
+ Arguments:
322
+ enumber error number
323
+ buffer where to put the message (zero terminated)
324
+ size size of the buffer in code units
325
+
326
+ Returns: length of message if all is well
327
+ negative on error
328
+ */
329
+
330
+ PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
331
+ pcre2_get_error_message(int enumber, PCRE2_UCHAR *buffer, PCRE2_SIZE size)
332
+ {
333
+ const unsigned char *message;
334
+ PCRE2_SIZE i;
335
+ int n, rc = 0;
336
+
337
+ if (size == 0) return PCRE2_ERROR_NOMEMORY;
338
+
339
+ if (enumber >= COMPILE_ERROR_BASE) /* Compile error */
340
+ {
341
+ message = compile_error_texts;
342
+ n = enumber - COMPILE_ERROR_BASE;
343
+ }
344
+ else if (enumber < 0) /* Match or UTF error */
345
+ {
346
+ message = match_error_texts;
347
+ n = -enumber;
348
+ }
349
+ else /* Invalid error number */
350
+ {
351
+ message = (const unsigned char *)"\0"; /* Empty message list */
352
+ n = 1;
353
+ }
354
+
355
+ for (; n > 0; n--)
356
+ {
357
+ while (*message++ != CHAR_NUL) {}
358
+ if (*message == CHAR_NUL) return PCRE2_ERROR_BADDATA;
359
+ }
360
+
361
+ for (i = 0; *message != 0; i++)
362
+ {
363
+ if (i >= size - 1)
364
+ {
365
+ rc = PCRE2_ERROR_NOMEMORY;
366
+ break;
367
+ }
368
+ buffer[i] = *message++;
369
+ }
370
+
371
+ #if defined EBCDIC && 'a' != 0x81
372
+ /* If compiling for EBCDIC, but the compiler's string literals are not EBCDIC,
373
+ then we are in the "force EBCDIC 1047" mode. I have chosen to add a few lines
374
+ here to translate the error strings on the fly, rather than require the string
375
+ literals above to be written out arduously using the "STR_XYZ" macros. */
376
+ for (PCRE2_SIZE j = 0; j < i; ++j)
377
+ buffer[j] = PRIV(ascii_to_ebcdic_1047)[buffer[j]];
378
+ #endif
379
+
380
+ buffer[i] = 0; /* Terminate message, even if truncated. */
381
+ return rc? rc : (int)i;
382
+ }
383
+
384
+ /* End of pcre2_error.c */
@@ -0,0 +1,159 @@
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
+ Original API code Copyright (c) 1997-2012 University of Cambridge
10
+ New API code Copyright (c) 2016-2024 University of Cambridge
11
+
12
+ -----------------------------------------------------------------------------
13
+ Redistribution and use in source and binary forms, with or without
14
+ modification, are permitted provided that the following conditions are met:
15
+
16
+ * Redistributions of source code must retain the above copyright notice,
17
+ this list of conditions and the following disclaimer.
18
+
19
+ * Redistributions in binary form must reproduce the above copyright
20
+ notice, this list of conditions and the following disclaimer in the
21
+ documentation and/or other materials provided with the distribution.
22
+
23
+ * Neither the name of the University of Cambridge nor the names of its
24
+ contributors may be used to endorse or promote products derived from
25
+ this software without specific prior written permission.
26
+
27
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37
+ POSSIBILITY OF SUCH DAMAGE.
38
+ -----------------------------------------------------------------------------
39
+ */
40
+
41
+
42
+ /* This module contains an internal function that is used to match a Unicode
43
+ extended grapheme sequence. It is used by both pcre2_match() and
44
+ pcre2_dfa_match(). However, it is called only when Unicode support is being
45
+ compiled. Nevertheless, we provide a dummy function when there is no Unicode
46
+ support, because some compilers do not like functionless source files. */
47
+
48
+
49
+ #include "pcre2_internal.h"
50
+
51
+
52
+
53
+ /* Dummy function */
54
+
55
+ #ifndef SUPPORT_UNICODE
56
+ PCRE2_SPTR
57
+ PRIV(extuni)(uint32_t c, PCRE2_SPTR eptr, PCRE2_SPTR start_subject,
58
+ PCRE2_SPTR end_subject, BOOL utf, int *xcount)
59
+ {
60
+ (void)c;
61
+ (void)eptr;
62
+ (void)start_subject;
63
+ (void)end_subject;
64
+ (void)utf;
65
+ (void)xcount;
66
+ return NULL;
67
+ }
68
+ #else
69
+
70
+
71
+ /*************************************************
72
+ * Match an extended grapheme sequence *
73
+ *************************************************/
74
+
75
+ /* NOTE: The logic contained in this function is replicated in three special-
76
+ purpose functions in the pcre2_jit_compile.c module. If the logic below is
77
+ changed, they must be kept in step so that the interpreter and the JIT have the
78
+ same behaviour.
79
+
80
+ Arguments:
81
+ c the first character
82
+ eptr pointer to next character
83
+ start_subject pointer to start of subject
84
+ end_subject pointer to end of subject
85
+ utf TRUE if in UTF mode
86
+ xcount pointer to count of additional characters,
87
+ or NULL if count not needed
88
+
89
+ Returns: pointer after the end of the sequence
90
+ */
91
+
92
+ PCRE2_SPTR
93
+ PRIV(extuni)(uint32_t c, PCRE2_SPTR eptr, PCRE2_SPTR start_subject,
94
+ PCRE2_SPTR end_subject, BOOL utf, int *xcount)
95
+ {
96
+ BOOL was_ep_ZWJ = FALSE;
97
+ int lgb = UCD_GRAPHBREAK(c);
98
+
99
+ while (eptr < end_subject)
100
+ {
101
+ int rgb;
102
+ int len = 1;
103
+ if (!utf) c = *eptr; else { GETCHARLEN(c, eptr, len); }
104
+ rgb = UCD_GRAPHBREAK(c);
105
+ if ((PRIV(ucp_gbtable)[lgb] & (1u << rgb)) == 0) break;
106
+
107
+ /* ZWJ followed by Extended Pictographic is allowed only if the ZWJ was
108
+ preceded by Extended Pictographic. */
109
+
110
+ if (lgb == ucp_gbZWJ && rgb == ucp_gbExtended_Pictographic && !was_ep_ZWJ)
111
+ break;
112
+
113
+ /* Not breaking between Regional Indicators is allowed only if there
114
+ are an even number of preceding RIs. */
115
+
116
+ if (lgb == ucp_gbRegional_Indicator && rgb == ucp_gbRegional_Indicator)
117
+ {
118
+ int ricount = 0;
119
+ PCRE2_SPTR bptr = eptr - 1;
120
+ if (utf) BACKCHAR(bptr);
121
+
122
+ /* bptr is pointing to the left-hand character */
123
+
124
+ while (bptr > start_subject)
125
+ {
126
+ bptr--;
127
+ if (utf)
128
+ {
129
+ BACKCHAR(bptr);
130
+ GETCHAR(c, bptr);
131
+ }
132
+ else
133
+ c = *bptr;
134
+ if (UCD_GRAPHBREAK(c) != ucp_gbRegional_Indicator) break;
135
+ ricount++;
136
+ }
137
+ if ((ricount & 1) != 0) break; /* Grapheme break required */
138
+ }
139
+
140
+ /* Set a flag when ZWJ follows Extended Pictographic (with optional Extend in
141
+ between; see next statement). */
142
+
143
+ was_ep_ZWJ = (lgb == ucp_gbExtended_Pictographic && rgb == ucp_gbZWJ);
144
+
145
+ /* If Extend follows Extended_Pictographic, do not update lgb; this allows
146
+ any number of them before a following ZWJ. */
147
+
148
+ if (rgb != ucp_gbExtend || lgb != ucp_gbExtended_Pictographic) lgb = rgb;
149
+
150
+ eptr += len;
151
+ if (xcount != NULL) *xcount += 1;
152
+ }
153
+
154
+ return eptr;
155
+ }
156
+
157
+ #endif /* SUPPORT_UNICODE */
158
+
159
+ /* End of pcre2_extuni.c */