NCBI C++ ToolKit
Classes | Macros | Typedefs | Functions | Variables
pcre2_dfa_match.c File Reference
#include "pcre2_internal.h"
+ Include dependency graph for pcre2_dfa_match.c:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  stateblock
 
struct  RWS_anchor
 

Macros

#define NLBLOCK   mb /* Block containing newline information */
 
#define PSSTART   start_subject /* Field containing processed string start */
 
#define PSEND   end_subject /* Field containing processed string end */
 
#define PUBLIC_DFA_MATCH_OPTIONS
 
#define OP_PROP_EXTRA   300
 
#define OP_EXTUNI_EXTRA   320
 
#define OP_ANYNL_EXTRA   340
 
#define OP_HSPACE_EXTRA   360
 
#define OP_VSPACE_EXTRA   380
 
#define INTS_PER_STATEBLOCK   (int)(sizeof(stateblock)/sizeof(int))
 
#define OVEC_UNIT   (sizeof(PCRE2_SIZE)/sizeof(int))
 
#define RWS_BASE_SIZE   (DFA_START_RWS_SIZE/sizeof(int)) /* Stack vector */
 
#define RWS_RSIZE   1000 /* Work size for recursion */
 
#define RWS_OVEC_RSIZE   (1000*OVEC_UNIT) /* Ovector for recursion */
 
#define RWS_OVEC_OSIZE   (2*OVEC_UNIT) /* Ovector in other cases */
 
#define RWS_ANCHOR_SIZE   (sizeof(RWS_anchor)/sizeof(int))
 
#define ADD_ACTIVE(x, y)
 
#define ADD_ACTIVE_DATA(x, y, z)
 
#define ADD_NEW(x, y)
 
#define ADD_NEW_DATA(x, y, z)
 
#define FF   (PCRE2_NOTEMPTY_SET|PCRE2_NE_ATST_SET)
 
#define OO   (PCRE2_NOTEMPTY|PCRE2_NOTEMPTY_ATSTART)
 

Typedefs

typedef struct stateblock stateblock
 
typedef struct RWS_anchor RWS_anchor
 

Functions

static int do_callout_dfa (PCRE2_SPTR code, PCRE2_SIZE *offsets, PCRE2_SPTR current_subject, PCRE2_SPTR ptr, dfa_match_block *mb, PCRE2_SIZE extracode, PCRE2_SIZE *lengthptr)
 
static int more_workspace (RWS_anchor **rwsptr, unsigned int ovecsize, dfa_match_block *mb)
 
static int internal_dfa_match (dfa_match_block *mb, PCRE2_SPTR this_start_code, PCRE2_SPTR current_subject, PCRE2_SIZE start_offset, PCRE2_SIZE *offsets, uint32_t offsetcount, int *workspace, int wscount, uint32_t rlevel, int *RWS)
 
PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_dfa_match (const pcre2_code *code, PCRE2_SPTR subject, PCRE2_SIZE length, PCRE2_SIZE start_offset, uint32_t options, pcre2_match_data *match_data, pcre2_match_context *mcontext, int *workspace, PCRE2_SIZE wscount)
 

Variables

static const uint8_t coptable []
 
static const uint8_t poptable []
 
static const uint8_t toptable1 []
 
static const uint8_t toptable2 []
 

Macro Definition Documentation

◆ ADD_ACTIVE

#define ADD_ACTIVE (   x,
 
)
Value:
if (active_count++ < wscount) \
{ \
next_active_state->offset = (x); \
next_active_state->count = (y); \
next_active_state++; \
} \
#define PCRE2_ERROR_DFA_WSSIZE
Definition: pcre2.h:390

Definition at line 483 of file pcre2_dfa_match.c.

◆ ADD_ACTIVE_DATA

#define ADD_ACTIVE_DATA (   x,
  y,
 
)
Value:
if (active_count++ < wscount) \
{ \
next_active_state->offset = (x); \
next_active_state->count = (y); \
next_active_state->data = (z); \
next_active_state++; \
} \

Definition at line 492 of file pcre2_dfa_match.c.

◆ ADD_NEW

#define ADD_NEW (   x,
 
)
Value:
if (new_count++ < wscount) \
{ \
next_new_state->offset = (x); \
next_new_state->count = (y); \
next_new_state++; \
} \

Definition at line 502 of file pcre2_dfa_match.c.

◆ ADD_NEW_DATA

#define ADD_NEW_DATA (   x,
  y,
 
)
Value:
if (new_count++ < wscount) \
{ \
next_new_state->offset = (x); \
next_new_state->count = (y); \
next_new_state->data = (z); \
next_new_state++; \
} \

Definition at line 511 of file pcre2_dfa_match.c.

◆ FF

◆ INTS_PER_STATEBLOCK

#define INTS_PER_STATEBLOCK   (int)(sizeof(stateblock)/sizeof(int))

Definition at line 303 of file pcre2_dfa_match.c.

◆ NLBLOCK

#define NLBLOCK   mb /* Block containing newline information */

Definition at line 79 of file pcre2_dfa_match.c.

◆ OO

◆ OP_ANYNL_EXTRA

#define OP_ANYNL_EXTRA   340

Definition at line 103 of file pcre2_dfa_match.c.

◆ OP_EXTUNI_EXTRA

#define OP_EXTUNI_EXTRA   320

Definition at line 102 of file pcre2_dfa_match.c.

◆ OP_HSPACE_EXTRA

#define OP_HSPACE_EXTRA   360

Definition at line 104 of file pcre2_dfa_match.c.

◆ OP_PROP_EXTRA

#define OP_PROP_EXTRA   300

Definition at line 101 of file pcre2_dfa_match.c.

◆ OP_VSPACE_EXTRA

#define OP_VSPACE_EXTRA   380

Definition at line 105 of file pcre2_dfa_match.c.

◆ OVEC_UNIT

#define OVEC_UNIT   (sizeof(PCRE2_SIZE)/sizeof(int))

Definition at line 317 of file pcre2_dfa_match.c.

◆ PSEND

#define PSEND   end_subject /* Field containing processed string end */

Definition at line 81 of file pcre2_dfa_match.c.

◆ PSSTART

#define PSSTART   start_subject /* Field containing processed string start */

Definition at line 80 of file pcre2_dfa_match.c.

◆ PUBLIC_DFA_MATCH_OPTIONS

#define PUBLIC_DFA_MATCH_OPTIONS
Value:
PCRE2_NOTEMPTY_ATSTART|PCRE2_NO_UTF_CHECK|PCRE2_PARTIAL_HARD| \
PCRE2_PARTIAL_SOFT|PCRE2_DFA_SHORTEST|PCRE2_DFA_RESTART| \
PCRE2_COPY_MATCHED_SUBJECT)
#define PCRE2_ANCHORED
Definition: pcre2.h:111
#define PCRE2_ENDANCHORED
Definition: pcre2.h:113
#define PCRE2_NOTBOL
Definition: pcre2.h:182
#define PCRE2_PARTIAL_HARD
Definition: pcre2.h:187
#define PCRE2_DFA_RESTART
Definition: pcre2.h:188
#define PCRE2_NO_UTF_CHECK
Definition: pcre2.h:112
#define PCRE2_DFA_SHORTEST
Definition: pcre2.h:189
#define PCRE2_NOTEMPTY
Definition: pcre2.h:184
#define PCRE2_NOTEOL
Definition: pcre2.h:183

Definition at line 85 of file pcre2_dfa_match.c.

◆ RWS_ANCHOR_SIZE

#define RWS_ANCHOR_SIZE   (sizeof(RWS_anchor)/sizeof(int))

Definition at line 332 of file pcre2_dfa_match.c.

◆ RWS_BASE_SIZE

#define RWS_BASE_SIZE   (DFA_START_RWS_SIZE/sizeof(int)) /* Stack vector */

Definition at line 319 of file pcre2_dfa_match.c.

◆ RWS_OVEC_OSIZE

#define RWS_OVEC_OSIZE   (2*OVEC_UNIT) /* Ovector in other cases */

Definition at line 322 of file pcre2_dfa_match.c.

◆ RWS_OVEC_RSIZE

#define RWS_OVEC_RSIZE   (1000*OVEC_UNIT) /* Ovector for recursion */

Definition at line 321 of file pcre2_dfa_match.c.

◆ RWS_RSIZE

#define RWS_RSIZE   1000 /* Work size for recursion */

Definition at line 320 of file pcre2_dfa_match.c.

Typedef Documentation

◆ RWS_anchor

typedef struct RWS_anchor RWS_anchor

◆ stateblock

typedef struct stateblock stateblock

Function Documentation

◆ do_callout_dfa()

static int do_callout_dfa ( PCRE2_SPTR  code,
PCRE2_SIZE offsets,
PCRE2_SPTR  current_subject,
PCRE2_SPTR  ptr,
dfa_match_block mb,
PCRE2_SIZE  extracode,
PCRE2_SIZE lengthptr 
)
static

◆ internal_dfa_match()

static int internal_dfa_match ( dfa_match_block mb,
PCRE2_SPTR  this_start_code,
PCRE2_SPTR  current_subject,
PCRE2_SIZE  start_offset,
PCRE2_SIZE offsets,
uint32_t  offsetcount,
int workspace,
int  wscount,
uint32_t  rlevel,
int RWS 
)
static

Definition at line 524 of file pcre2_dfa_match.c.

References ADD_ACTIVE, ADD_NEW, ADD_NEW_DATA, dfa_match_block::allowemptypartial, dfa_match_block::bsr_convention, CHAR_COMMERCIAL_AT, CHAR_CR, CHAR_DOLLAR_SIGN, CHAR_FF, CHAR_GRAVE_ACCENT, CHAR_LF, CHAR_NEL, CHAR_VT, ucd_record::chartype, coptable, stateblock::count, count, ctype_word, ctypes_offset, stateblock::data, do_callout_dfa(), dfa_match_block::end_subject, FALSE, fcc_offset, RWS_anchor::free, GET2, GET_UCD, GETCHARLEN, GETCHARTEST, dfa_recursion_info::group_num, HSPACE_CASES, i, IMM2_SIZE, int, INTS_PER_STATEBLOCK, IS_NEWLINE, dfa_recursion_info::last_used_ptr, dfa_match_block::last_used_ptr, lcc_offset, LINK_SIZE, MAPBIT, dfa_match_block::match_call_count, dfa_match_block::match_limit, dfa_match_block::match_limit_depth, max(), MAX_UTF_CODE_POINT, memmove, dfa_match_block::moptions, more_workspace(), NLBLOCK, dfa_match_block::nllen, NLTYPE_FIXED, NOTACHAR, NULL, offset, stateblock::offset, offsets, OP_ALLANY, OP_ALT, OP_ANY, OP_ANYBYTE, OP_ANYNL, OP_ANYNL_EXTRA, OP_ASSERT, OP_ASSERT_NOT, OP_ASSERTBACK, OP_ASSERTBACK_NOT, OP_BRA, OP_BRAMINZERO, OP_BRAPOS, OP_BRAPOSZERO, OP_BRAZERO, OP_CALLOUT, OP_CALLOUT_STR, OP_CBRA, OP_CBRAPOS, OP_CHAR, OP_CHARI, OP_CIRC, OP_CIRCM, OP_CLASS, OP_COND, OP_CREF, OP_CRMINPLUS, OP_CRMINQUERY, OP_CRMINRANGE, OP_CRMINSTAR, OP_CRPLUS, OP_CRPOSPLUS, OP_CRPOSQUERY, OP_CRPOSRANGE, OP_CRPOSSTAR, OP_CRQUERY, OP_CRRANGE, OP_CRSTAR, OP_DIGIT, OP_DNCREF, OP_DNRREF, OP_DOLL, OP_DOLLM, OP_EOD, OP_EODN, OP_EXACT, OP_EXACTI, OP_EXTUNI, OP_EXTUNI_EXTRA, OP_FAIL, OP_FALSE, OP_HSPACE, OP_HSPACE_EXTRA, OP_KET, OP_KETRMAX, OP_KETRMIN, OP_KETRPOS, OP_MINPLUS, OP_MINPLUSI, OP_MINQUERY, OP_MINQUERYI, OP_MINSTAR, OP_MINSTARI, OP_MINUPTO, OP_MINUPTOI, OP_NCLASS, OP_NOT, OP_NOT_DIGIT, OP_NOT_HSPACE, OP_NOT_UCP_WORD_BOUNDARY, OP_NOT_VSPACE, OP_NOT_WHITESPACE, OP_NOT_WORD_BOUNDARY, OP_NOT_WORDCHAR, OP_NOTEXACT, OP_NOTEXACTI, OP_NOTI, OP_NOTMINPLUS, OP_NOTMINPLUSI, OP_NOTMINQUERY, OP_NOTMINQUERYI, OP_NOTMINSTAR, OP_NOTMINSTARI, OP_NOTMINUPTO, OP_NOTMINUPTOI, OP_NOTPLUS, OP_NOTPLUSI, OP_NOTPOSPLUS, OP_NOTPOSPLUSI, OP_NOTPOSQUERY, OP_NOTPOSQUERYI, OP_NOTPOSSTAR, OP_NOTPOSSTARI, OP_NOTPOSUPTO, OP_NOTPOSUPTOI, OP_NOTPROP, OP_NOTQUERY, OP_NOTQUERYI, OP_NOTSTAR, OP_NOTSTARI, OP_NOTUPTO, OP_NOTUPTOI, OP_ONCE, OP_PLUS, OP_PLUSI, OP_POSPLUS, OP_POSPLUSI, OP_POSQUERY, OP_POSQUERYI, OP_POSSTAR, OP_POSSTARI, OP_POSUPTO, OP_POSUPTOI, OP_PROP, OP_PROP_EXTRA, OP_QUERY, OP_QUERYI, OP_RECURSE, OP_REVERSE, OP_RREF, OP_SBRA, OP_SBRAPOS, OP_SCBRA, OP_SCBRAPOS, OP_SCOND, OP_SKIPZERO, OP_SOD, OP_SOM, OP_STAR, OP_STARI, OP_TABLE_LENGTH, OP_TRUE, OP_TYPEEXACT, OP_TYPEMINPLUS, OP_TYPEMINQUERY, OP_TYPEMINSTAR, OP_TYPEMINUPTO, OP_TYPEPLUS, OP_TYPEPOSPLUS, OP_TYPEPOSQUERY, OP_TYPEPOSSTAR, OP_TYPEPOSUPTO, OP_TYPEQUERY, OP_TYPESTAR, OP_TYPEUPTO, OP_UCP_WORD_BOUNDARY, OP_UPTO, OP_UPTOI, OP_VSPACE, OP_VSPACE_EXTRA, OP_WHITESPACE, OP_WORD_BOUNDARY, OP_WORDCHAR, OP_XCLASS, OVEC_UNIT, PCRE2_ALT_CIRCUMFLEX, PCRE2_BSR_ANYCRLF, PCRE2_DFA_RESTART, PCRE2_DFA_SHORTEST, PCRE2_DOLLAR_ENDONLY, PCRE2_ENDANCHORED, PCRE2_ERROR_DEPTHLIMIT, PCRE2_ERROR_DFA_RECURSE, PCRE2_ERROR_DFA_UCOND, PCRE2_ERROR_DFA_UITEM, PCRE2_ERROR_MATCHLIMIT, PCRE2_ERROR_NOMATCH, PCRE2_ERROR_PARTIAL, PCRE2_ERROR_RECURSELOOP, PCRE2_NOTBOL, PCRE2_NOTEMPTY, PCRE2_NOTEMPTY_ATSTART, PCRE2_NOTEOL, PCRE2_PARTIAL_HARD, PCRE2_PARTIAL_SOFT, PCRE2_SIZE, PCRE2_SPTR, PCRE2_UCHAR, PCRE2_UCP, PCRE2_UTF, poptable, dfa_match_block::poptions, dfa_recursion_info::prevrec, PRIV, PT_ALNUM, PT_ANY, PT_BIDICL, PT_BOOL, PT_CLIST, PT_GC, PT_LAMP, PT_PC, PT_PXSPACE, PT_SC, PT_SCX, PT_SPACE, PT_UCNC, PT_WORD, dfa_match_block::recursive, RREF_ANY, RWS_OVEC_OSIZE, RWS_OVEC_RSIZE, RWS_RSIZE, ucd_record::script, RWS_anchor::size, dfa_match_block::start_code, dfa_match_block::start_offset, dfa_match_block::start_subject, dfa_match_block::start_used_ptr, dfa_recursion_info::subject_position, TABLE_GET, dfa_match_block::tables, toptable1, toptable2, TRUE, UCD_BIDICLASS, UCD_BPROPS_PROP, UCD_CHARTYPE, UCD_OTHERCASE, UCD_SCRIPTX_PROP, UCHAR21TEST, ucp_L, ucp_Ll, ucp_Lt, ucp_Lu, ucp_Mn, ucp_N, ucp_Pc, ucp_Z, uint32_t, utf, rapidjson::value, VSPACE_CASES, and WAS_NEWLINE.

Referenced by pcre2_dfa_match().

◆ more_workspace()

static int more_workspace ( RWS_anchor **  rwsptr,
unsigned int  ovecsize,
dfa_match_block mb 
)
static

◆ pcre2_dfa_match()

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_dfa_match ( const pcre2_code code,
PCRE2_SPTR  subject,
PCRE2_SIZE  length,
PCRE2_SIZE  start_offset,
uint32_t  options,
pcre2_match_data match_data,
pcre2_match_context mcontext,
int workspace,
PCRE2_SIZE  wscount 
)

Definition at line 3349 of file pcre2_dfa_match.c.

References dfa_match_block::allowemptypartial, pcre2_real_code::bsr_convention, dfa_match_block::bsr_convention, dfa_match_block::callout, dfa_match_block::callout_data, dfa_match_block::cb, CHAR_CR, CHAR_NL, CHAR_NUL, CU2BYTES, dfa_match_block::end_subject, FALSE, fcc_offset, FF, pcre2_real_code::first_codeunit, pcre2_real_code::flags, RWS_anchor::free, pcre2_memctl::free, dfa_match_block::heap_limit, dfa_match_block::heap_used, i, internal_dfa_match(), INTS_PER_STATEBLOCK, IS_NEWLINE, pcre2_real_code::last_codeunit, dfa_match_block::last_used_ptr, pcre2_real_code::limit_depth, pcre2_real_code::limit_heap, pcre2_real_code::limit_match, MAGIC_NUMBER, pcre2_real_code::magic_number, dfa_match_block::match_call_count, match_data, dfa_match_block::match_limit, dfa_match_block::match_limit_depth, pcre2_real_code::max_lookbehind, pcre2_real_code::memctl, dfa_match_block::memctl, pcre2_memctl::memory_data, dfa_match_block::moptions, pcre2_real_code::name_count, pcre2_real_code::name_entry_size, pcre2_real_code::newline_convention, next(), RWS_anchor::next, dfa_match_block::nl, dfa_match_block::nllen, dfa_match_block::nltype, NLTYPE_ANY, NLTYPE_ANYCRLF, NLTYPE_FIXED, NULL, ok, OO, pcre2_real_code::overall_options, PCRE2_ANCHORED, pcre2_callout_block, PCRE2_CODE_UNIT_WIDTH, PCRE2_COPY_MATCHED_SUBJECT, PCRE2_DFA_RESTART, PCRE2_ENDANCHORED, PCRE2_ERROR_BADMAGIC, PCRE2_ERROR_BADMODE, PCRE2_ERROR_BADOFFSET, PCRE2_ERROR_BADOFFSETLIMIT, PCRE2_ERROR_BADOPTION, PCRE2_ERROR_BADUTFOFFSET, PCRE2_ERROR_DFA_BADRESTART, PCRE2_ERROR_DFA_UINVALID_UTF, PCRE2_ERROR_DFA_WSSIZE, PCRE2_ERROR_INTERNAL, PCRE2_ERROR_NOMATCH, PCRE2_ERROR_NOMEMORY, PCRE2_ERROR_NULL, PCRE2_ERROR_PARTIAL, PCRE2_FIRSTCASELESS, PCRE2_FIRSTLINE, PCRE2_FIRSTMAPSET, PCRE2_FIRSTSET, PCRE2_HASCRORLF, PCRE2_LASTCASELESS, PCRE2_LASTSET, PCRE2_MATCH_EMPTY, PCRE2_MATCH_INVALID_UTF, PCRE2_MATCHEDBY_DFA_INTERPRETER, PCRE2_MD_COPIED_SUBJECT, PCRE2_MODE_MASK, PCRE2_NEWLINE_ANY, PCRE2_NEWLINE_ANYCRLF, PCRE2_NEWLINE_CR, PCRE2_NEWLINE_CRLF, PCRE2_NEWLINE_LF, PCRE2_NEWLINE_NUL, PCRE2_NO_START_OPTIMIZE, PCRE2_NO_UTF_CHECK, PCRE2_PARTIAL_HARD, PCRE2_PARTIAL_SOFT, PCRE2_SIZE, PCRE2_SPTR, PCRE2_STARTLINE, PCRE2_UCHAR, PCRE2_UCP, PCRE2_UNSET, PCRE2_USE_OFFSET_LIMIT, PCRE2_UTF, PCRE2_ZERO_TERMINATED, dfa_match_block::poptions, PRIV, PUBLIC_DFA_MATCH_OPTIONS, dfa_match_block::recursive, REQ_CU_MAX, RWS_ANCHOR_SIZE, RWS_BASE_SIZE, RWS_anchor::size, pcre2_real_code::start_bitmap, dfa_match_block::start_code, dfa_match_block::start_offset, dfa_match_block::start_subject, dfa_match_block::start_used_ptr, subject, t, TABLE_GET, pcre2_real_code::tables, dfa_match_block::tables, TRUE, UCD_OTHERCASE, UCHAR21INCTEST, UCHAR21TEST, utf, valid_utf(), and WAS_NEWLINE.

Referenced by LLVMFuzzerTestOneInput().

Variable Documentation

◆ coptable

const uint8_t coptable[]
static

Definition at line 116 of file pcre2_dfa_match.c.

Referenced by internal_dfa_match().

◆ poptable

const uint8_t poptable[]
static

Definition at line 199 of file pcre2_dfa_match.c.

Referenced by internal_dfa_match().

◆ toptable1

const uint8_t toptable1[]
static
Initial value:
= {
0, 0, 0, 0, 0, 0,
0x08 , 0x08 ,
0x01 , 0x01 ,
0x10 , 0x10 ,
0, 0
}

Definition at line 275 of file pcre2_dfa_match.c.

Referenced by internal_dfa_match().

◆ toptable2

const uint8_t toptable2[]
static
Initial value:
= {
0, 0, 0, 0, 0, 0,
0x08 , 0,
0x01 , 0,
0x10 , 0,
1, 1
}

Definition at line 283 of file pcre2_dfa_match.c.

Referenced by internal_dfa_match().

Modified on Fri Sep 20 14:58:26 2024 by modify_doxy.py rev. 669887