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 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 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 <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 error was encountered is returned via the <i>erroroffset</i> argument.
values are set to zero for a successful return. </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>
<P> <P>
There is a complete description of the PCRE2 native API, with more detail on 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 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, error code and an offset (number of code units) within the pattern,
respectively, when <b>pcre2_compile()</b> returns NULL because a compilation respectively, when <b>pcre2_compile()</b> returns NULL because a compilation
error has occurred. The values are both zero when compilation is successful error has occurred.
and <b>pcre2_compile()</b> returns a non-NULL value.
</P> </P>
<P> <P>
There are nearly 100 positive error codes that <b>pcre2_compile()</b> may return 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" message"
<a href="#geterrormessage">below)</a> <a href="#geterrormessage">below)</a>
should be self-explanatory. Macro names starting with PCRE2_ERROR_ are defined 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>
<P> <P>
The value returned in <i>erroroffset</i> is an indication of where in the 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 an error occurred. When there is no error, zero is returned. A non-zero
pattern that was read. For example, after the error "lookbehind assertion is value is not necessarily the furthest point in the pattern that was read. For
not fixed length", the error offset points to the start of the failing example, after the error "lookbehind assertion is not fixed length", the error
assertion. For an invalid UTF-8 or UTF-16 string, the offset is that of the offset points to the start of the failing assertion. For an invalid UTF-8 or
first code unit of the failing character. UTF-16 string, the offset is that of the first code unit of the failing
character.
</P> </P>
<P> <P>
Some errors are not detected until the whole pattern has been scanned; in these 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 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- error code and an offset (number of code units) within the pattern, re-
spectively, when pcre2_compile() returns NULL because a compilation er- spectively, when pcre2_compile() returns NULL because a compilation er-
ror has occurred. The values are both zero when compilation is success- ror has occurred.
ful and pcre2_compile() returns a non-NULL value.
There are nearly 100 positive error codes that pcre2_compile() may re- 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 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- 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 ing is in force. These are the same as given by pcre2_match() and
pcre2_dfa_match(), and are described in the pcre2unicode documentation. pcre2_dfa_match(), and are described in the pcre2unicode documentation.
There is no separate documentation for the positive error codes, be- There is no separate documentation for the positive error codes, be-
cause the textual error messages that are obtained by calling the cause the textual error messages that are obtained by calling the
pcre2_get_error_message() function (see "Obtaining a textual error mes- pcre2_get_error_message() function (see "Obtaining a textual error mes-
sage" below) should be self-explanatory. Macro names starting with sage" below) should be self-explanatory. Macro names starting with
PCRE2_ERROR_ are defined for both positive and negative error codes in PCRE2_ERROR_ are defined for both positive and negative error codes in
pcre2.h. 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- 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 tern an error occurred. When there is no error, zero is returned. A
the pattern that was read. For example, after the error "lookbehind as- non-zero value is not necessarily the furthest point in the pattern
sertion is not fixed length", the error offset points to the start of that was read. For example, after the error "lookbehind assertion is
the failing assertion. For an invalid UTF-8 or UTF-16 string, the off- not fixed length", the error offset points to the start of the failing
set is that of the first code unit of the failing character. 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; 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. 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 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 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 \fBpcre2_get_error_message()\fP function. The offset (in code units) where the
error was encountered is returned via the \fIerroroffset\fP argument. Both error was encountered is returned via the \fIerroroffset\fP argument.
values are set to zero for a successful return. .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 .P
There is a complete description of the PCRE2 native API, with more detail on There is a complete description of the PCRE2 native API, with more detail on
each option, in the 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 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, error code and an offset (number of code units) within the pattern,
respectively, when \fBpcre2_compile()\fP returns NULL because a compilation respectively, when \fBpcre2_compile()\fP returns NULL because a compilation
error has occurred. The values are both zero when compilation is successful error has occurred.
and \fBpcre2_compile()\fP returns a non-NULL value.
.P .P
There are nearly 100 positive error codes that \fBpcre2_compile()\fP may return 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 if it finds an error in the pattern. There are also some negative error codes
@ -1343,14 +1342,17 @@ message"
below) below)
.\" .\"
should be self-explanatory. Macro names starting with PCRE2_ERROR_ are defined 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 .P
The value returned in \fIerroroffset\fP is an indication of where in the 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 an error occurred. When there is no error, zero is returned. A non-zero
pattern that was read. For example, after the error "lookbehind assertion is value is not necessarily the furthest point in the pattern that was read. For
not fixed length", the error offset points to the start of the failing example, after the error "lookbehind assertion is not fixed length", the error
assertion. For an invalid UTF-8 or UTF-16 string, the offset is that of the offset points to the start of the failing assertion. For an invalid UTF-8 or
first code unit of the failing character. 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 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 cases, the offset passed back is the length of the pattern. Note that the