![]() |
Fun 0.41.5
The programming language that makes you have fun!
|
Implements the OP_PCRE2_TEST opcode (conditional build). More...
#include <pcre2.h>Go to the source code of this file.
Macros | |
| #define | PCRE2_CODE_UNIT_WIDTH 8 |
Functions | |
| if (vflags.type==VAL_INT||vflags.type==VAL_BOOL) flags | |
| free_value (vflags) | |
| free_value (vtext) | |
| free_value (vpat) | |
| if (!pattern||!subject) | |
| if (flags &1) opt| | |
| if (!re) | |
| pcre2_match_data_free (mdata) | |
| pcre2_code_free (re) | |
| free (pattern) | |
| free (subject) | |
| push_value (vm, make_int(rc >=0 ? 1 :0)) | |
Variables | |
| case | OP_PCRE2_TEST |
| Value | vtext = pop_value(vm) |
| Value | vpat = pop_value(vm) |
| int | flags = 0 |
| char * | pattern = value_to_string_alloc(&vpat) |
| char * | subject = value_to_string_alloc(&vtext) |
| int | errorcode |
| PCRE2_SIZE | erroff |
| uint32_t | opt = 0 |
| pcre2_code * | re = pcre2_compile((PCRE2_SPTR)pattern, PCRE2_ZERO_TERMINATED, opt, &errorcode, &erroff, NULL) |
| pcre2_match_data * | mdata = pcre2_match_data_create_from_pattern(re, NULL) |
| int | rc = pcre2_match(re, (PCRE2_SPTR)subject, (PCRE2_SIZE)strlen(subject), 0, 0, mdata, NULL) |
| break | |
Implements the OP_PCRE2_TEST opcode (conditional build).
Tests whether a PCRE2 pattern matches a subject string and returns 1 on success or 0 otherwise when FUN_WITH_PCRE2 is enabled. When PCRE2 support is disabled at build time, the opcode always returns 0.
Definition in file test.c.
| free | ( | pattern | ) |
| free | ( | subject | ) |
| free_value | ( | vflags | ) |
| free_value | ( | vpat | ) |
| free_value | ( | vtext | ) |
| if | ( | flags & | 1 | ) |
| pcre2_code_free | ( | re | ) |
| pcre2_match_data_free | ( | mdata | ) |
| pcre2_match_data* mdata = pcre2_match_data_create_from_pattern(re, NULL) |
| case OP_PCRE2_TEST |
OP_PCRE2_TEST: (pattern:any, text:any, flags:int|bool=0) -> int
Behavior when FUN_WITH_PCRE2 is enabled:
Behavior when FUN_WITH_PCRE2 is disabled:
| char* pattern = value_to_string_alloc(&vpat) |
| char* subject = value_to_string_alloc(&vtext) |