Skip to main content

Crate stix_pattern

Crate stix_pattern 

Source
Expand description

Lexer and parser for the STIX 2.1 patterning language.

§Example

use stix_pattern::parse;

let pattern = parse("[file:hashes.'SHA-256' = 'abc']").unwrap();
let json = serde_json::to_string(&pattern).unwrap();
assert!(json.contains("SHA-256"));

Re-exports§

pub use error::ParseError;
pub use error::Span;
pub use parser::parse;
pub use ast::*;

Modules§

ast
Abstract syntax tree for STIX 2.1 patterns. All nodes are serde-serializable.
error
Error and source-span types for parsing.
lexer
Lexer: converts a pattern string into a flat token stream.
parser
Recursive-descent parser: tokens -> AST.