PCRE2 C++ Wrapper 1.3.0
pcre2cpp
Loading...
Searching...
No Matches
match_error_codes.hpp
1/*
2 * pcre2cpp - PCRE2 cpp wrapper
3 *
4 * Licensed under the BSD 3-Clause License with Attribution Requirement.
5 * See the LICENSE file for details: https://github.com/MAIPA01/pcre2cpp/blob/main/LICENSE
6 *
7 * Copyright (c) 2025, Patryk Antosik (MAIPA01)
8 *
9 * PCRE2 library included in this project:
10 * Copyright (c) 2016-2024, University of Cambridge.
11 *
12 * See the LICENSE_PCRE2 file for details: https://github.com/MAIPA01/pcre2cpp/blob/main/LICENSE_PCRE2
13 */
14#pragma once
15#ifndef _PCRE2CPP_MATCH_ERROR_CODES_HPP_
16 #define _PCRE2CPP_MATCH_ERROR_CODES_HPP_
17
18 #include <pcre2cpp/config.hpp>
19
21_PCRE2CPP_ERROR("This is only available for c++17 and greater!");
22 #else
23
24 #include <pcre2cpp/types.hpp>
25
26namespace pcre2cpp {
27 /**
28 * @brief Error codes which can be returned when match fail (now not used but maybe in future)
29 * @ingroup pcre2cpp
30 */
32 /// @brief No error (default)
33 None = 1,
34 /// @brief The subject string did not match the pattern.
36 /// @brief The subject string did not match, but it did match partially.
38 /** @details
39 * PCRE2 stores a 4-byte "magic number" at the start of the compiled code,
40 * to catch the case when it is passed a junk pointer.
41 * This is the error that is returned when the magic number is not present
42 */
44 /** @details
45 * This error is given when a compiled pattern is passed
46 * to a function in a library of a different code unit width, for example,
47 * a pattern compiled by the 8-bit library is passed to a 16-bit or 32-bit library function.
48 */
50 /// @brief The value of startoffset was greater than the length of the subject.
52 /// @brief An unrecognized bit was set in the options argument.
54 /** @details
55 * The UTF code unit sequence that was passed as a subject was checked
56 * and found to be valid (the match_option::NoUTFCheck option was not set),
57 * but the value of startoffset did not point to the beginning of a
58 * UTF character or the end of the subject.
59 */
61 /** @details
62 * This error is never generated by pcre2_match() itself.
63 * It is provided for use by callout functions that want to cause
64 * pcre2_match() or pcre2_callout_enumerate() to return a distinctive error code.
65 */
67 /// @brief The nested backtracking depth limit was reached.
69 /// @brief The heap limit was reached.
71 /** @details
72 * An unexpected internal error has occurred.
73 * This error could be caused by a bug in PCRE2 or by overwriting of the compiled pattern.
74 */
76 /** @details
77 * This error is returned when a pattern that was successfully
78 * studied using JIT is being matched, but the memory available
79 * for the just-in-time processing stack is not large enough.
80 */
82 /// @brief The backtracking match limit was reached.
84 /** @details
85 * Heap memory is used to remember backtracking points.
86 * This error is given when the memory allocation function (default or custom) fails.
87 * Note that a different error, PCRE2_ERROR_HEAPLIMIT, is given if the amount of memory
88 * needed exceeds the heap limit. match_error_codes::NoMemory is also returned
89 * if match_options_bits::CopyMatchedSubject is set and memory allocation fails.
90 */
92 /// @brief Either the code, subject, or match_data argument was passed as nullptr.
94 /** @details
95 * This error is returned when pcre2_match() detects a recursion loop within the pattern.
96 * Specifically, it means that either the whole pattern or a capture group has been called
97 * recursively for the second time at the same position in the subject string.
98 * Some simple patterns that might do this are detected and faulted at compile time,
99 * but more complicated cases, in particular mutual recursions between two different groups,
100 * cannot be detected until matching is attempted.
101 */
103 };
104} // namespace pcre2cpp
105 #endif
106#endif
base pcre2cpp exception class
Definition exceptions.hpp:134
match_error_codes
Error codes which can be returned when match fail (now not used but maybe in future).
Definition match_error_codes.hpp:31
@ DepthLimit
The nested backtracking depth limit was reached.
Definition match_error_codes.hpp:68
@ Callout
Definition match_error_codes.hpp:66
@ BadMode
Definition match_error_codes.hpp:49
@ BadOption
An unrecognized bit was set in the options argument.
Definition match_error_codes.hpp:53
@ Partial
The subject string did not match, but it did match partially.
Definition match_error_codes.hpp:37
@ JITStackLimit
Definition match_error_codes.hpp:81
@ RecurseLoop
Definition match_error_codes.hpp:102
@ None
No error (default).
Definition match_error_codes.hpp:33
@ NoMemory
Definition match_error_codes.hpp:91
@ Internal
Definition match_error_codes.hpp:75
@ BadUTFOffset
Definition match_error_codes.hpp:60
@ Null
Either the code, subject, or match_data argument was passed as nullptr.
Definition match_error_codes.hpp:93
@ MatchLimit
The backtracking match limit was reached.
Definition match_error_codes.hpp:83
@ BadMagic
Definition match_error_codes.hpp:43
@ NoMatch
The subject string did not match the pattern.
Definition match_error_codes.hpp:35
@ HeapLimit
The heap limit was reached.
Definition match_error_codes.hpp:70
@ BadOffset
The value of startoffset was greater than the length of the subject.
Definition match_error_codes.hpp:51
#define _PCRE2CPP_HAS_CXX17
check if compiler has c++ version greater or equal to c++17
Definition config.hpp:133