vyre 0.4.0

GPU compute intermediate representation with a standard operation library
Documentation
use super::{match_tokens, parse};
use crate::ops::string_matching::search_contract::{
    validate_haystack, validate_needle, MatchError,
};

/// Return true when `input` matches a Sigma-style wildcard pattern.
///
/// `*` matches any byte sequence, `?` matches one byte, and `\` escapes the
/// next pattern byte so literal wildcard bytes can be matched.
///
/// # Errors
///
/// Returns `Fix: ...` when pattern or input exceeds the documented T47 cap.
pub fn wildcard_match(pattern: &[u8], input: &[u8]) -> Result<bool, MatchError> {
    validate_needle(pattern)?;
    validate_haystack(input)?;
    let tokens = parse(pattern);
    Ok(match_tokens(&tokens, input))
}