Skip to content

Commit c2882d3

Browse files
committed
Update constants
TODO: Add them to API
1 parent a6f950f commit c2882d3

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This is a friendly API that is very similar to .NET's `System.Text.RegularExpres
3434
- Callbacks: `Func<PcreMatch, string>`
3535
- Replacement strings with placeholders: ``$n ${name} $& $_ $` $' $+``
3636
- Using `Substitute`, the PCRE2 API:
37-
- Replacement strings with placeholders: ``$n ${n} $$ $*MARK ${*MARK}``
37+
- Replacement strings with placeholders: ``$n ${n} $& $_ $` $' $$ $*MARK ${*MARK}``
3838
- Callouts for matches and substitutions
3939
- String splitting on matches: `Split`
4040

src/PCRE.NET/Internal/PcreConstants.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ internal static class PcreConstants
4040
public const uint EXTENDED_MORE = 0x01000000;
4141
public const uint LITERAL = 0x02000000;
4242
public const uint MATCH_INVALID_UTF = 0x04000000;
43+
public const uint ALT_EXTENDED_CLASS = 0x08000000;
4344
public const uint EXTRA_ALLOW_SURROGATE_ESCAPES = 0x00000001;
4445
public const uint EXTRA_BAD_ESCAPE_IS_LITERAL = 0x00000002;
4546
public const uint EXTRA_MATCH_WORD = 0x00000004;
@@ -53,10 +54,15 @@ internal static class PcreConstants
5354
public const uint EXTRA_ASCII_BSW = 0x00000400;
5455
public const uint EXTRA_ASCII_POSIX = 0x00000800;
5556
public const uint EXTRA_ASCII_DIGIT = 0x00001000;
57+
public const uint EXTRA_PYTHON_OCTAL = 0x00002000;
58+
public const uint EXTRA_NO_BS0 = 0x00004000;
59+
public const uint EXTRA_NEVER_CALLOUT = 0x00008000;
60+
public const uint EXTRA_TURKISH_CASING = 0x00010000;
5661
public const uint JIT_COMPLETE = 0x00000001;
5762
public const uint JIT_PARTIAL_SOFT = 0x00000002;
5863
public const uint JIT_PARTIAL_HARD = 0x00000004;
5964
public const uint JIT_INVALID_UTF = 0x00000100;
65+
public const uint JIT_TEST_ALLOC = 0x00000200;
6066
public const uint NOTBOL = 0x00000001;
6167
public const uint NOTEOL = 0x00000002;
6268
public const uint NOTEMPTY = 0x00000004;
@@ -188,8 +194,25 @@ internal static class PcreConstants
188194
public const int ERROR_ALPHA_ASSERTION_UNKNOWN = 195;
189195
public const int ERROR_SCRIPT_RUN_NOT_AVAILABLE = 196;
190196
public const int ERROR_TOO_MANY_CAPTURES = 197;
191-
public const int ERROR_CONDITION_ATOMIC_ASSERTION_EXPECTED = 198;
197+
public const int ERROR_MISSING_OCTAL_DIGIT = 198;
192198
public const int ERROR_BACKSLASH_K_IN_LOOKAROUND = 199;
199+
public const int ERROR_MAX_VAR_LOOKBEHIND_EXCEEDED = 200;
200+
public const int ERROR_PATTERN_COMPILED_SIZE_TOO_BIG = 201;
201+
public const int ERROR_OVERSIZE_PYTHON_OCTAL = 202;
202+
public const int ERROR_CALLOUT_CALLER_DISABLED = 203;
203+
public const int ERROR_EXTRA_CASING_REQUIRES_UNICODE = 204;
204+
public const int ERROR_TURKISH_CASING_REQUIRES_UTF = 205;
205+
public const int ERROR_EXTRA_CASING_INCOMPATIBLE = 206;
206+
public const int ERROR_ECLASS_NEST_TOO_DEEP = 207;
207+
public const int ERROR_ECLASS_INVALID_OPERATOR = 208;
208+
public const int ERROR_ECLASS_UNEXPECTED_OPERATOR = 209;
209+
public const int ERROR_ECLASS_EXPECTED_OPERAND = 210;
210+
public const int ERROR_ECLASS_MIXED_OPERATORS = 211;
211+
public const int ERROR_ECLASS_HINT_SQUARE_BRACKET = 212;
212+
public const int ERROR_PERL_ECLASS_UNEXPECTED_EXPR = 213;
213+
public const int ERROR_PERL_ECLASS_EMPTY_EXPR = 214;
214+
public const int ERROR_PERL_ECLASS_MISSING_CLOSE = 215;
215+
public const int ERROR_PERL_ECLASS_UNEXPECTED_CHAR = 216;
193216
public const int ERROR_NOMATCH = -1;
194217
public const int ERROR_PARTIAL = -2;
195218
public const int ERROR_UTF8_ERR1 = -3;
@@ -257,6 +280,9 @@ internal static class PcreConstants
257280
public const int ERROR_INTERNAL_DUPMATCH = -65;
258281
public const int ERROR_DFA_UINVALID_UTF = -66;
259282
public const int ERROR_INVALIDOFFSET = -67;
283+
public const int ERROR_JIT_UNSUPPORTED = -68;
284+
public const int ERROR_REPLACECASE = -69;
285+
public const int ERROR_TOOLARGEREPLACE = -70;
260286
public const uint INFO_ALLOPTIONS = 0;
261287
public const uint INFO_ARGOPTIONS = 1;
262288
public const uint INFO_BACKREFMAX = 2;
@@ -299,6 +325,17 @@ internal static class PcreConstants
299325
public const uint CONFIG_NEVER_BACKSLASH_C = 13;
300326
public const uint CONFIG_COMPILED_WIDTHS = 14;
301327
public const uint CONFIG_TABLES_LENGTH = 15;
328+
public const uint OPTIMIZATION_NONE = 0;
329+
public const uint OPTIMIZATION_FULL = 1;
330+
public const uint AUTO_POSSESS = 64;
331+
public const uint AUTO_POSSESS_OFF = 65;
332+
public const uint DOTSTAR_ANCHOR = 66;
333+
public const uint DOTSTAR_ANCHOR_OFF = 67;
334+
public const uint START_OPTIMIZE = 68;
335+
public const uint START_OPTIMIZE_OFF = 69;
336+
public const uint SUBSTITUTE_CASE_LOWER = 1;
337+
public const uint SUBSTITUTE_CASE_UPPER = 2;
338+
public const uint SUBSTITUTE_CASE_TITLE_FIRST = 3;
302339
public const uint CALLOUT_STARTMATCH = 0x00000001;
303340
public const uint CALLOUT_BACKTRACK = 0x00000002;
304341
}

src/PCRE.NET/PcreErrorCode.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Diagnostics.CodeAnalysis;
23
using PCRE.Internal;
34

@@ -501,10 +502,16 @@ public enum PcreErrorCode
501502
/// </summary>
502503
TooManyCaptures = PcreConstants.ERROR_TOO_MANY_CAPTURES,
503504

505+
/// <summary>
506+
/// <c>PCRE2_ERROR_MISSING_OCTAL_DIGIT</c> - Octal digit missing after <c>\0</c> (PCRE2_EXTRA_NO_BS0 is set).
507+
/// </summary>
508+
MissingOctalDigit = PcreConstants.ERROR_MISSING_OCTAL_DIGIT,
509+
504510
/// <summary>
505511
/// <c>PCRE2_ERROR_CONDITION_ATOMIC_ASSERTION_EXPECTED</c> - Atomic assertion expected after <c>(?(</c> or <c>(?(?C)</c>
506512
/// </summary>
507-
ConditionAtomicAssertionExpected = PcreConstants.ERROR_CONDITION_ATOMIC_ASSERTION_EXPECTED,
513+
[Obsolete($"Not used anymore, shares the code with {nameof(MissingOctalDigit)}")]
514+
ConditionAtomicAssertionExpected = MissingOctalDigit,
508515

509516
/// <summary>
510517
/// <c>PCRE2_ERROR_BACKSLASH_K_IN_LOOKAROUND</c> - <c>\K</c> is not allowed in lookarounds (but see <see cref="PcreExtraCompileOptions.AllowLookaroundBsK"/>).

0 commit comments

Comments
 (0)