Condex


Extract tokens by simple condition expression.

CI Crates.io Licensed Twitter

| Docs | Latest Note |

toml [dependencies] condex = "1.0.0"


Example

```rust

#[derive(Debug, Clone, Copy, PartialEq)]
enum Token {
    TagName,
    NameType,
    Value,
    AllInOne,
}
impl TokenKind for Token {}

let mut builder = CondexBuilder::new(&[
    (Token::TagName, &["@-("]),
    (Token::NameType, &["[(,]  -  :  - [,=]"]),
    (Token::Value, &["=-[,)]"]),
    (Token::AllInOne, &["@-(", "[(,]  -  :  - [,=]", "=-[,)]"]),
]);

let source = "@hello-man(name: type = value, name2: type2, name3: type3 = value3)";

for (i, c) in source.char_indices() {
    builder.test(c, i);
}
let finals = builder.finalize_with_source(source);
eprintln!("{:#?}", finals);

```