compiler
only.Expand description
FFI wrappers for different types of pattern strings.
Vectorscan supports 3 distinct types of pattern strings which can be formed to produce a database:
Expression
: Vectorscan PCRE-like regex syntax (null-terminatedCString
).Literal
: Literal byte string (Vec<u8>
) which may contain nulls.chimera::ChimeraExpression
: PCRE regex syntax.
Each vectorscan database only supports matching against exactly one type
of these patterns, but each pattern string variant also has a *Set
form,
and all of these forms support the same interface to vectorscan’s most
powerful feature: multi-pattern matching, where patterns registered with
ExprId
in a set can be associated to
ExpressionIndex
instances when matched
against.
Creating instances of these structs performs no pattern compilation itself,
which is instead performed in a subsequent step by e.g.
Database::compile()
. References to these structs can be reused multiple
times to create multiple databases without re-allocating the underlying
pattern string data:
use vectorscan::{expression::*, flags::*};
let a: Expression = "a+".parse()?;
let b: Expression = "b+".parse()?;
let c: Expression = "c+".parse()?;
let ab_db = ExpressionSet::from_exprs([&a, &b]).compile(Mode::BLOCK)?;
let bc_db = ExpressionSet::from_exprs([&b, &c]).compile(Mode::BLOCK)?;
let ca_db = ExpressionSet::from_exprs([&c, &a]).compile(Mode::BLOCK)?;
Modules§
- chimera
chimera
- Pattern strings for the chimera library.
- info
- Data produced by vectorscan to analyze a particular expression.
Structs§
- ExprExt
- Configuration for extended vectorscan parameters.
- ExprId
- The ID number to associate with a pattern match in an expression set.
- Expression
- Vectorscan regex pattern string.
- Expression
Set - Collection of regular expressions.
- Literal
- A literal byte string.
- Literal
Set - Collection of literals.