2014-03-07 18:28:52 +01:00
|
|
|
/*************************************************
|
|
|
|
* Perl-Compatible Regular Expressions *
|
|
|
|
*************************************************/
|
|
|
|
|
|
|
|
/* PCRE is a library of functions to support regular expressions whose syntax
|
|
|
|
and semantics are as close as possible to those of the Perl 5 language.
|
|
|
|
|
|
|
|
Written by Philip Hazel
|
|
|
|
Original API code Copyright (c) 1997-2012 University of Cambridge
|
2017-03-12 14:47:01 +01:00
|
|
|
New API code Copyright (c) 2016-2017 University of Cambridge
|
2014-03-07 18:28:52 +01:00
|
|
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above copyright notice,
|
|
|
|
this list of conditions and the following disclaimer.
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
|
|
|
documentation and/or other materials provided with the distribution.
|
|
|
|
|
|
|
|
* Neither the name of the University of Cambridge nor the names of its
|
|
|
|
contributors may be used to endorse or promote products derived from
|
|
|
|
this software without specific prior written permission.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "pcre2_internal.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************
|
|
|
|
* Return info about compiled pattern *
|
|
|
|
*************************************************/
|
|
|
|
|
2014-04-30 18:55:24 +02:00
|
|
|
/*
|
2014-03-07 18:28:52 +01:00
|
|
|
Arguments:
|
|
|
|
code points to compiled code
|
|
|
|
what what information is required
|
2014-10-16 18:49:23 +02:00
|
|
|
where where to put the information; if NULL, return length
|
2014-03-07 18:28:52 +01:00
|
|
|
|
2014-10-16 18:49:23 +02:00
|
|
|
Returns: 0 when data returned
|
|
|
|
> 0 when length requested
|
|
|
|
< 0 on error or unset value
|
2014-03-07 18:28:52 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
|
|
|
|
pcre2_pattern_info(const pcre2_code *code, uint32_t what, void *where)
|
|
|
|
{
|
2014-04-18 17:37:56 +02:00
|
|
|
const pcre2_real_code *re = (pcre2_real_code *)code;
|
2014-04-30 18:55:24 +02:00
|
|
|
|
2014-10-16 18:49:23 +02:00
|
|
|
if (where == NULL) /* Requests field length */
|
|
|
|
{
|
|
|
|
switch(what)
|
|
|
|
{
|
|
|
|
case PCRE2_INFO_ALLOPTIONS:
|
|
|
|
case PCRE2_INFO_ARGOPTIONS:
|
|
|
|
case PCRE2_INFO_BACKREFMAX:
|
|
|
|
case PCRE2_INFO_BSR:
|
|
|
|
case PCRE2_INFO_CAPTURECOUNT:
|
2017-03-12 14:47:01 +01:00
|
|
|
case PCRE2_INFO_DEPTHLIMIT:
|
2014-10-16 18:49:23 +02:00
|
|
|
case PCRE2_INFO_FIRSTCODETYPE:
|
|
|
|
case PCRE2_INFO_FIRSTCODEUNIT:
|
2015-12-17 19:44:06 +01:00
|
|
|
case PCRE2_INFO_HASBACKSLASHC:
|
2014-10-16 18:49:23 +02:00
|
|
|
case PCRE2_INFO_HASCRORLF:
|
2017-04-11 13:47:25 +02:00
|
|
|
case PCRE2_INFO_HEAPLIMIT:
|
2014-10-16 18:49:23 +02:00
|
|
|
case PCRE2_INFO_JCHANGED:
|
|
|
|
case PCRE2_INFO_LASTCODETYPE:
|
|
|
|
case PCRE2_INFO_LASTCODEUNIT:
|
|
|
|
case PCRE2_INFO_MATCHEMPTY:
|
|
|
|
case PCRE2_INFO_MATCHLIMIT:
|
|
|
|
case PCRE2_INFO_MAXLOOKBEHIND:
|
|
|
|
case PCRE2_INFO_MINLENGTH:
|
|
|
|
case PCRE2_INFO_NAMEENTRYSIZE:
|
|
|
|
case PCRE2_INFO_NAMECOUNT:
|
|
|
|
case PCRE2_INFO_NEWLINE:
|
2014-10-20 19:28:49 +02:00
|
|
|
return sizeof(uint32_t);
|
2014-10-16 18:49:23 +02:00
|
|
|
|
|
|
|
case PCRE2_INFO_FIRSTBITMAP:
|
|
|
|
return sizeof(const uint8_t *);
|
|
|
|
|
|
|
|
case PCRE2_INFO_JITSIZE:
|
|
|
|
case PCRE2_INFO_SIZE:
|
2017-03-16 18:55:55 +01:00
|
|
|
case PCRE2_INFO_FRAMESIZE:
|
2014-10-20 19:28:49 +02:00
|
|
|
return sizeof(size_t);
|
2014-10-16 18:49:23 +02:00
|
|
|
|
|
|
|
case PCRE2_INFO_NAMETABLE:
|
2014-10-20 19:28:49 +02:00
|
|
|
return sizeof(PCRE2_SPTR);
|
2014-10-16 18:49:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (re == NULL) return PCRE2_ERROR_NULL;
|
2014-04-30 18:55:24 +02:00
|
|
|
|
2014-04-18 17:37:56 +02:00
|
|
|
/* Check that the first field in the block is the magic number. If it is not,
|
2014-09-19 09:43:39 +02:00
|
|
|
return with PCRE2_ERROR_BADMAGIC. */
|
|
|
|
|
|
|
|
if (re->magic_number != MAGIC_NUMBER) return PCRE2_ERROR_BADMAGIC;
|
|
|
|
|
2014-04-30 18:55:24 +02:00
|
|
|
/* Check that this pattern was compiled in the correct bit mode */
|
|
|
|
|
2014-10-16 18:49:23 +02:00
|
|
|
if ((re->flags & (PCRE2_CODE_UNIT_WIDTH/8)) == 0) return PCRE2_ERROR_BADMODE;
|
2014-04-18 17:37:56 +02:00
|
|
|
|
|
|
|
switch(what)
|
|
|
|
{
|
2014-06-24 17:30:10 +02:00
|
|
|
case PCRE2_INFO_ALLOPTIONS:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = re->overall_options;
|
2014-06-24 17:30:10 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PCRE2_INFO_ARGOPTIONS:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = re->compile_options;
|
2014-06-24 17:30:10 +02:00
|
|
|
break;
|
|
|
|
|
2014-04-30 18:55:24 +02:00
|
|
|
case PCRE2_INFO_BACKREFMAX:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = re->top_backref;
|
2014-04-30 18:55:24 +02:00
|
|
|
break;
|
|
|
|
|
2014-06-24 17:30:10 +02:00
|
|
|
case PCRE2_INFO_BSR:
|
2014-04-30 18:55:24 +02:00
|
|
|
*((uint32_t *)where) = re->bsr_convention;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PCRE2_INFO_CAPTURECOUNT:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = re->top_bracket;
|
2014-04-30 18:55:24 +02:00
|
|
|
break;
|
|
|
|
|
2017-03-12 14:47:01 +01:00
|
|
|
case PCRE2_INFO_DEPTHLIMIT:
|
|
|
|
*((uint32_t *)where) = re->limit_depth;
|
|
|
|
if (re->limit_depth == UINT32_MAX) return PCRE2_ERROR_UNSET;
|
|
|
|
break;
|
|
|
|
|
2014-04-30 18:55:24 +02:00
|
|
|
case PCRE2_INFO_FIRSTCODETYPE:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = ((re->flags & PCRE2_FIRSTSET) != 0)? 1 :
|
|
|
|
((re->flags & PCRE2_STARTLINE) != 0)? 2 : 0;
|
2014-04-30 18:55:24 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PCRE2_INFO_FIRSTCODEUNIT:
|
|
|
|
*((uint32_t *)where) = ((re->flags & PCRE2_FIRSTSET) != 0)?
|
|
|
|
re->first_codeunit : 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PCRE2_INFO_FIRSTBITMAP:
|
|
|
|
*((const uint8_t **)where) = ((re->flags & PCRE2_FIRSTMAPSET) != 0)?
|
|
|
|
&(re->start_bitmap[0]) : NULL;
|
|
|
|
break;
|
|
|
|
|
2017-03-16 18:55:55 +01:00
|
|
|
case PCRE2_INFO_FRAMESIZE:
|
2017-05-11 18:28:54 +02:00
|
|
|
*((size_t *)where) = offsetof(heapframe, ovector) +
|
|
|
|
re->top_bracket * 2 * sizeof(PCRE2_SIZE);
|
2017-03-16 18:55:55 +01:00
|
|
|
break;
|
|
|
|
|
2015-11-14 18:28:19 +01:00
|
|
|
case PCRE2_INFO_HASBACKSLASHC:
|
|
|
|
*((uint32_t *)where) = (re->flags & PCRE2_HASBKC) != 0;
|
|
|
|
break;
|
|
|
|
|
2014-04-30 18:55:24 +02:00
|
|
|
case PCRE2_INFO_HASCRORLF:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = (re->flags & PCRE2_HASCRORLF) != 0;
|
2014-04-30 18:55:24 +02:00
|
|
|
break;
|
|
|
|
|
2017-04-11 13:47:25 +02:00
|
|
|
case PCRE2_INFO_HEAPLIMIT:
|
|
|
|
*((uint32_t *)where) = re->limit_heap;
|
|
|
|
if (re->limit_heap == UINT32_MAX) return PCRE2_ERROR_UNSET;
|
|
|
|
break;
|
|
|
|
|
2014-04-30 18:55:24 +02:00
|
|
|
case PCRE2_INFO_JCHANGED:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = (re->flags & PCRE2_JCHANGED) != 0;
|
2014-04-30 18:55:24 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PCRE2_INFO_JITSIZE:
|
|
|
|
#ifdef SUPPORT_JIT
|
|
|
|
*((size_t *)where) = (re->executable_jit != NULL)?
|
|
|
|
PRIV(jit_get_size)(re->executable_jit) : 0;
|
|
|
|
#else
|
|
|
|
*((size_t *)where) = 0;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PCRE2_INFO_LASTCODETYPE:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = ((re->flags & PCRE2_LASTSET) != 0)? 1 : 0;
|
2014-04-30 18:55:24 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PCRE2_INFO_LASTCODEUNIT:
|
|
|
|
*((uint32_t *)where) = ((re->flags & PCRE2_LASTSET) != 0)?
|
|
|
|
re->last_codeunit : 0;
|
|
|
|
break;
|
|
|
|
|
2014-06-24 17:30:10 +02:00
|
|
|
case PCRE2_INFO_MATCHEMPTY:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = (re->flags & PCRE2_MATCH_EMPTY) != 0;
|
2014-04-30 18:55:24 +02:00
|
|
|
break;
|
|
|
|
|
2014-06-24 17:30:10 +02:00
|
|
|
case PCRE2_INFO_MATCHLIMIT:
|
2014-04-30 18:55:24 +02:00
|
|
|
*((uint32_t *)where) = re->limit_match;
|
2014-10-16 18:49:23 +02:00
|
|
|
if (re->limit_match == UINT32_MAX) return PCRE2_ERROR_UNSET;
|
2014-04-30 18:55:24 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PCRE2_INFO_MAXLOOKBEHIND:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = re->max_lookbehind;
|
2014-04-30 18:55:24 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PCRE2_INFO_MINLENGTH:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = re->minlength;
|
2014-04-30 18:55:24 +02:00
|
|
|
break;
|
|
|
|
|
2014-04-18 17:37:56 +02:00
|
|
|
case PCRE2_INFO_NAMEENTRYSIZE:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = re->name_entry_size;
|
2014-04-18 17:37:56 +02:00
|
|
|
break;
|
2014-04-30 18:55:24 +02:00
|
|
|
|
2014-04-18 17:37:56 +02:00
|
|
|
case PCRE2_INFO_NAMECOUNT:
|
2014-08-15 11:55:18 +02:00
|
|
|
*((uint32_t *)where) = re->name_count;
|
2014-04-18 17:37:56 +02:00
|
|
|
break;
|
2014-04-30 18:55:24 +02:00
|
|
|
|
|
|
|
case PCRE2_INFO_NAMETABLE:
|
2014-10-16 18:49:23 +02:00
|
|
|
*((PCRE2_SPTR *)where) = (PCRE2_SPTR)((char *)re + sizeof(pcre2_real_code));
|
2014-04-30 18:55:24 +02:00
|
|
|
break;
|
|
|
|
|
2014-06-24 17:30:10 +02:00
|
|
|
case PCRE2_INFO_NEWLINE:
|
2014-04-30 18:55:24 +02:00
|
|
|
*((uint32_t *)where) = re->newline_convention;
|
|
|
|
break;
|
|
|
|
|
2014-04-18 17:37:56 +02:00
|
|
|
case PCRE2_INFO_SIZE:
|
2014-06-14 20:29:51 +02:00
|
|
|
*((size_t *)where) = re->blocksize;
|
2014-04-30 18:55:24 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default: return PCRE2_ERROR_BADOPTION;
|
|
|
|
}
|
2014-04-18 17:37:56 +02:00
|
|
|
|
|
|
|
return 0;
|
2014-03-07 18:28:52 +01:00
|
|
|
}
|
|
|
|
|
2015-03-23 16:52:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************
|
|
|
|
* Callout enumerator *
|
|
|
|
*************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
Arguments:
|
|
|
|
code points to compiled code
|
|
|
|
callback function called for each callout block
|
|
|
|
callout_data user data passed to the callback
|
|
|
|
|
|
|
|
Returns: 0 when successfully completed
|
|
|
|
< 0 on local error
|
2015-06-18 18:39:25 +02:00
|
|
|
!= 0 for callback error
|
2015-03-23 16:52:08 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
|
|
|
|
pcre2_callout_enumerate(const pcre2_code *code,
|
|
|
|
int (*callback)(pcre2_callout_enumerate_block *, void *), void *callout_data)
|
|
|
|
{
|
|
|
|
pcre2_real_code *re = (pcre2_real_code *)code;
|
|
|
|
pcre2_callout_enumerate_block cb;
|
|
|
|
PCRE2_SPTR cc;
|
|
|
|
#ifdef SUPPORT_UNICODE
|
2017-03-21 17:31:54 +01:00
|
|
|
BOOL utf;
|
2015-03-23 16:52:08 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (re == NULL) return PCRE2_ERROR_NULL;
|
|
|
|
|
2017-03-21 17:31:54 +01:00
|
|
|
#ifdef SUPPORT_UNICODE
|
|
|
|
utf = (re->overall_options & PCRE2_UTF) != 0;
|
|
|
|
#endif
|
|
|
|
|
2015-03-23 16:52:08 +01:00
|
|
|
/* Check that the first field in the block is the magic number. If it is not,
|
|
|
|
return with PCRE2_ERROR_BADMAGIC. */
|
|
|
|
|
|
|
|
if (re->magic_number != MAGIC_NUMBER) return PCRE2_ERROR_BADMAGIC;
|
|
|
|
|
|
|
|
/* Check that this pattern was compiled in the correct bit mode */
|
|
|
|
|
|
|
|
if ((re->flags & (PCRE2_CODE_UNIT_WIDTH/8)) == 0) return PCRE2_ERROR_BADMODE;
|
|
|
|
|
|
|
|
cb.version = 0;
|
|
|
|
cc = (PCRE2_SPTR)((uint8_t *)re + sizeof(pcre2_real_code))
|
|
|
|
+ re->name_count * re->name_entry_size;
|
|
|
|
|
|
|
|
while (TRUE)
|
|
|
|
{
|
2015-06-18 18:39:25 +02:00
|
|
|
int rc;
|
2015-03-23 16:52:08 +01:00
|
|
|
switch (*cc)
|
|
|
|
{
|
|
|
|
case OP_END:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case OP_CHAR:
|
|
|
|
case OP_CHARI:
|
|
|
|
case OP_NOT:
|
|
|
|
case OP_NOTI:
|
|
|
|
case OP_STAR:
|
|
|
|
case OP_MINSTAR:
|
|
|
|
case OP_PLUS:
|
|
|
|
case OP_MINPLUS:
|
|
|
|
case OP_QUERY:
|
|
|
|
case OP_MINQUERY:
|
|
|
|
case OP_UPTO:
|
|
|
|
case OP_MINUPTO:
|
|
|
|
case OP_EXACT:
|
|
|
|
case OP_POSSTAR:
|
|
|
|
case OP_POSPLUS:
|
|
|
|
case OP_POSQUERY:
|
|
|
|
case OP_POSUPTO:
|
|
|
|
case OP_STARI:
|
|
|
|
case OP_MINSTARI:
|
|
|
|
case OP_PLUSI:
|
|
|
|
case OP_MINPLUSI:
|
|
|
|
case OP_QUERYI:
|
|
|
|
case OP_MINQUERYI:
|
|
|
|
case OP_UPTOI:
|
|
|
|
case OP_MINUPTOI:
|
|
|
|
case OP_EXACTI:
|
|
|
|
case OP_POSSTARI:
|
|
|
|
case OP_POSPLUSI:
|
|
|
|
case OP_POSQUERYI:
|
|
|
|
case OP_POSUPTOI:
|
|
|
|
case OP_NOTSTAR:
|
|
|
|
case OP_NOTMINSTAR:
|
|
|
|
case OP_NOTPLUS:
|
|
|
|
case OP_NOTMINPLUS:
|
|
|
|
case OP_NOTQUERY:
|
|
|
|
case OP_NOTMINQUERY:
|
|
|
|
case OP_NOTUPTO:
|
|
|
|
case OP_NOTMINUPTO:
|
|
|
|
case OP_NOTEXACT:
|
|
|
|
case OP_NOTPOSSTAR:
|
|
|
|
case OP_NOTPOSPLUS:
|
|
|
|
case OP_NOTPOSQUERY:
|
|
|
|
case OP_NOTPOSUPTO:
|
|
|
|
case OP_NOTSTARI:
|
|
|
|
case OP_NOTMINSTARI:
|
|
|
|
case OP_NOTPLUSI:
|
|
|
|
case OP_NOTMINPLUSI:
|
|
|
|
case OP_NOTQUERYI:
|
|
|
|
case OP_NOTMINQUERYI:
|
|
|
|
case OP_NOTUPTOI:
|
|
|
|
case OP_NOTMINUPTOI:
|
|
|
|
case OP_NOTEXACTI:
|
|
|
|
case OP_NOTPOSSTARI:
|
|
|
|
case OP_NOTPOSPLUSI:
|
|
|
|
case OP_NOTPOSQUERYI:
|
|
|
|
case OP_NOTPOSUPTOI:
|
|
|
|
cc += PRIV(OP_lengths)[*cc];
|
|
|
|
#ifdef SUPPORT_UNICODE
|
|
|
|
if (utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OP_TYPESTAR:
|
|
|
|
case OP_TYPEMINSTAR:
|
|
|
|
case OP_TYPEPLUS:
|
|
|
|
case OP_TYPEMINPLUS:
|
|
|
|
case OP_TYPEQUERY:
|
|
|
|
case OP_TYPEMINQUERY:
|
|
|
|
case OP_TYPEUPTO:
|
|
|
|
case OP_TYPEMINUPTO:
|
|
|
|
case OP_TYPEEXACT:
|
|
|
|
case OP_TYPEPOSSTAR:
|
|
|
|
case OP_TYPEPOSPLUS:
|
|
|
|
case OP_TYPEPOSQUERY:
|
|
|
|
case OP_TYPEPOSUPTO:
|
|
|
|
cc += PRIV(OP_lengths)[*cc];
|
|
|
|
#ifdef SUPPORT_UNICODE
|
|
|
|
if (cc[-1] == OP_PROP || cc[-1] == OP_NOTPROP) cc += 2;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
#if defined SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH != 8
|
|
|
|
case OP_XCLASS:
|
|
|
|
cc += GET(cc, 1);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case OP_MARK:
|
|
|
|
case OP_PRUNE_ARG:
|
|
|
|
case OP_SKIP_ARG:
|
|
|
|
case OP_THEN_ARG:
|
|
|
|
cc += PRIV(OP_lengths)[*cc] + cc[1];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OP_CALLOUT:
|
|
|
|
cb.pattern_position = GET(cc, 1);
|
|
|
|
cb.next_item_length = GET(cc, 1 + LINK_SIZE);
|
|
|
|
cb.callout_number = cc[1 + 2*LINK_SIZE];
|
|
|
|
cb.callout_string_offset = 0;
|
|
|
|
cb.callout_string_length = 0;
|
|
|
|
cb.callout_string = NULL;
|
|
|
|
rc = callback(&cb, callout_data);
|
2015-06-18 18:39:25 +02:00
|
|
|
if (rc != 0) return rc;
|
2015-03-23 16:52:08 +01:00
|
|
|
cc += PRIV(OP_lengths)[*cc];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OP_CALLOUT_STR:
|
|
|
|
cb.pattern_position = GET(cc, 1);
|
|
|
|
cb.next_item_length = GET(cc, 1 + LINK_SIZE);
|
|
|
|
cb.callout_number = 0;
|
|
|
|
cb.callout_string_offset = GET(cc, 1 + 3*LINK_SIZE);
|
|
|
|
cb.callout_string_length =
|
|
|
|
GET(cc, 1 + 2*LINK_SIZE) - (1 + 4*LINK_SIZE) - 2;
|
|
|
|
cb.callout_string = cc + (1 + 4*LINK_SIZE) + 1;
|
|
|
|
rc = callback(&cb, callout_data);
|
2015-06-18 18:39:25 +02:00
|
|
|
if (rc != 0) return rc;
|
2015-03-23 16:52:08 +01:00
|
|
|
cc += GET(cc, 1 + 2*LINK_SIZE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
cc += PRIV(OP_lengths)[*cc];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-07 18:28:52 +01:00
|
|
|
/* End of pcre2_pattern_info.c */
|