Function hyperscan_sys::chimera::ch_compile_multi
source · [−]pub unsafe extern "C" fn ch_compile_multi(
expressions: *const *const c_char,
flags: *const c_uint,
ids: *const c_uint,
elements: c_uint,
mode: c_uint,
platform: *const hs_platform_info_t,
db: *mut *mut ch_database_t,
compile_error: *mut *mut ch_compile_error_t
) -> ch_error_t
Expand description
The multiple regular expression compiler.
This is the function call with which a set of expressions is compiled into a database which can be passed to the runtime function (@ref ch_scan()). Each expression can be labelled with a unique integer which is passed into the match callback to identify the pattern that has matched.
@param expressions
Array of NULL-terminated expressions to compile. Note that (as for @ref
ch_compile()) these strings must contain only the pattern to be
matched, with no delimiters or flags. For example, the expression
/abc?def/i
should be compiled by providing abc?def
as the first
string in the @a expressions array, and @ref CH_FLAG_CASELESS as the
first value in the @a flags array.
@param flags
Array of flags which modify the behaviour of each expression. Multiple
flags may be used by ORing them together. Specifying the NULL pointer
in place of an array will set the flags value for all patterns to zero.
Valid values are:
- CH_FLAG_CASELESS - Matching will be performed case-insensitively.
- CH_FLAG_DOTALL - Matching a .
will not exclude newlines.
- CH_FLAG_MULTILINE - ^
and $
anchors match any newlines in data.
- CH_FLAG_SINGLEMATCH - Only one match will be generated by patterns
with this match id per stream.
- CH_FLAG_UTF8 - Treat this pattern as a sequence of UTF-8 characters.
- CH_FLAG_UCP - Use Unicode properties for character classes.
@param ids An array of integers specifying the ID number to be associated with the corresponding pattern in the expressions array. Specifying the NULL pointer in place of an array will set the ID value for all patterns to zero.
@param elements The number of elements in the input arrays.
@param mode Compiler mode flag that affect the database as a whole for capturing groups. One of CH_MODE_NOGROUPS or CH_MODE_GROUPS must be supplied. See @ref CH_MODE_FLAG for more details.
@param platform If not NULL, the platform structure is used to determine the target platform for the database. If NULL, a database suitable for running on the current host platform is produced.
@param db On success, a pointer to the generated database will be returned in this parameter, or NULL on failure. The caller is responsible for deallocating the buffer using the @ref ch_free_database() function.
@param compile_error If the compile fails, a pointer to a @ref ch_compile_error_t will be returned, providing details of the error condition. The caller is responsible for deallocating the buffer using the @ref ch_free_compile_error() function.
@return @ref CH_SUCCESS is returned on successful compilation; @ref CH_COMPILER_ERROR on failure, with details provided in the @a error parameter.