Fix recent documentation error

This commit is contained in:
Philip Hazel 2022-04-22 17:51:31 +01:00
parent 8ebf9efe7b
commit fedf4d9d40
5 changed files with 49 additions and 36 deletions

View File

@ -98,8 +98,12 @@ private data structure that contains the compiled pattern, or NULL if an error
was detected. In the error case, a text error message can be obtained by
passing the value returned via the <i>errorcode</i> argument to the the
<b>pcre2_get_error_message()</b> function. The offset (in code units) where the
error was encountered is returned via the <i>erroroffset</i> argument. Both
values are set to zero for a successful return.
error was encountered is returned via the <i>erroroffset</i> argument.
</P>
<P>
If there is no error, the value passed via <i>errorcode</i> returns the message
"no error" if passed to <b>pcre2_get_error_message()</b>, and the value passed
via <i>erroroffset</i> is zero.
</P>
<P>
There is a complete description of the PCRE2 native API, with more detail on

View File

@ -1383,8 +1383,7 @@ If <i>errorcode</i> or <i>erroroffset</i> is NULL, <b>pcre2_compile()</b> return
NULL immediately. Otherwise, the variables to which these point are set to an
error code and an offset (number of code units) within the pattern,
respectively, when <b>pcre2_compile()</b> returns NULL because a compilation
error has occurred. The values are both zero when compilation is successful
and <b>pcre2_compile()</b> returns a non-NULL value.
error has occurred.
</P>
<P>
There are nearly 100 positive error codes that <b>pcre2_compile()</b> may return
@ -1399,15 +1398,18 @@ because the textual error messages that are obtained by calling the
message"
<a href="#geterrormessage">below)</a>
should be self-explanatory. Macro names starting with PCRE2_ERROR_ are defined
for both positive and negative error codes in <b>pcre2.h</b>.
for both positive and negative error codes in <b>pcre2.h</b>. When compilation
is successful <i>errorcode</i> is set to a value that returns the message "no
error" if passed to <b>pcre2_get_error_message()</b>.
</P>
<P>
The value returned in <i>erroroffset</i> is an indication of where in the
pattern the error occurred. It is not necessarily the furthest point in the
pattern that was read. For example, after the error "lookbehind assertion is
not fixed length", the error offset points to the start of the failing
assertion. For an invalid UTF-8 or UTF-16 string, the offset is that of the
first code unit of the failing character.
pattern an error occurred. When there is no error, zero is returned. A non-zero
value is not necessarily the furthest point in the pattern that was read. For
example, after the error "lookbehind assertion is not fixed length", the error
offset points to the start of the failing assertion. For an invalid UTF-8 or
UTF-16 string, the offset is that of the first code unit of the failing
character.
</P>
<P>
Some errors are not detected until the whole pattern has been scanned; in these

View File

@ -1372,27 +1372,29 @@ COMPILING A PATTERN
diately. Otherwise, the variables to which these point are set to an
error code and an offset (number of code units) within the pattern, re-
spectively, when pcre2_compile() returns NULL because a compilation er-
ror has occurred. The values are both zero when compilation is success-
ful and pcre2_compile() returns a non-NULL value.
ror has occurred.
There are nearly 100 positive error codes that pcre2_compile() may re-
turn if it finds an error in the pattern. There are also some negative
error codes that are used for invalid UTF strings when validity check-
ing is in force. These are the same as given by pcre2_match() and
There are nearly 100 positive error codes that pcre2_compile() may re-
turn if it finds an error in the pattern. There are also some negative
error codes that are used for invalid UTF strings when validity check-
ing is in force. These are the same as given by pcre2_match() and
pcre2_dfa_match(), and are described in the pcre2unicode documentation.
There is no separate documentation for the positive error codes, be-
cause the textual error messages that are obtained by calling the
There is no separate documentation for the positive error codes, be-
cause the textual error messages that are obtained by calling the
pcre2_get_error_message() function (see "Obtaining a textual error mes-
sage" below) should be self-explanatory. Macro names starting with
PCRE2_ERROR_ are defined for both positive and negative error codes in
pcre2.h.
sage" below) should be self-explanatory. Macro names starting with
PCRE2_ERROR_ are defined for both positive and negative error codes in
pcre2.h. When compilation is successful errorcode is set to a value
that returns the message "no error" if passed to pcre2_get_error_mes-
sage().
The value returned in erroroffset is an indication of where in the pat-
tern the error occurred. It is not necessarily the furthest point in
the pattern that was read. For example, after the error "lookbehind as-
sertion is not fixed length", the error offset points to the start of
the failing assertion. For an invalid UTF-8 or UTF-16 string, the off-
set is that of the first code unit of the failing character.
tern an error occurred. When there is no error, zero is returned. A
non-zero value is not necessarily the furthest point in the pattern
that was read. For example, after the error "lookbehind assertion is
not fixed length", the error offset points to the start of the failing
assertion. For an invalid UTF-8 or UTF-16 string, the offset is that of
the first code unit of the failing character.
Some errors are not detected until the whole pattern has been scanned;
in these cases, the offset passed back is the length of the pattern.

View File

@ -86,8 +86,11 @@ private data structure that contains the compiled pattern, or NULL if an error
was detected. In the error case, a text error message can be obtained by
passing the value returned via the \fIerrorcode\fP argument to the the
\fBpcre2_get_error_message()\fP function. The offset (in code units) where the
error was encountered is returned via the \fIerroroffset\fP argument. Both
values are set to zero for a successful return.
error was encountered is returned via the \fIerroroffset\fP argument.
.P
If there is no error, the value passed via \fIerrorcode\fP returns the message
"no error" if passed to \fBpcre2_get_error_message()\fP, and the value passed
via \fIerroroffset\fP is zero.
.P
There is a complete description of the PCRE2 native API, with more detail on
each option, in the

View File

@ -1323,8 +1323,7 @@ If \fIerrorcode\fP or \fIerroroffset\fP is NULL, \fBpcre2_compile()\fP returns
NULL immediately. Otherwise, the variables to which these point are set to an
error code and an offset (number of code units) within the pattern,
respectively, when \fBpcre2_compile()\fP returns NULL because a compilation
error has occurred. The values are both zero when compilation is successful
and \fBpcre2_compile()\fP returns a non-NULL value.
error has occurred.
.P
There are nearly 100 positive error codes that \fBpcre2_compile()\fP may return
if it finds an error in the pattern. There are also some negative error codes
@ -1343,14 +1342,17 @@ message"
below)
.\"
should be self-explanatory. Macro names starting with PCRE2_ERROR_ are defined
for both positive and negative error codes in \fBpcre2.h\fP.
for both positive and negative error codes in \fBpcre2.h\fP. When compilation
is successful \fIerrorcode\fP is set to a value that returns the message "no
error" if passed to \fBpcre2_get_error_message()\fP.
.P
The value returned in \fIerroroffset\fP is an indication of where in the
pattern the error occurred. It is not necessarily the furthest point in the
pattern that was read. For example, after the error "lookbehind assertion is
not fixed length", the error offset points to the start of the failing
assertion. For an invalid UTF-8 or UTF-16 string, the offset is that of the
first code unit of the failing character.
pattern an error occurred. When there is no error, zero is returned. A non-zero
value is not necessarily the furthest point in the pattern that was read. For
example, after the error "lookbehind assertion is not fixed length", the error
offset points to the start of the failing assertion. For an invalid UTF-8 or
UTF-16 string, the offset is that of the first code unit of the failing
character.
.P
Some errors are not detected until the whole pattern has been scanned; in these
cases, the offset passed back is the length of the pattern. Note that the