condex

Crates.iocondex
lib.rscondex
version1.0.0
sourcesrc
created_at2021-11-01 02:34:24.901858
updated_at2021-11-01 02:34:24.901858
descriptionExtract tokens by simple condition expression.
homepagehttps://github.com/just-do-halee/condex
repositoryhttps://github.com/just-do-halee/condex
max_upload_size
id474987
size25,121
Doha Lee (just-do-halee)

documentation

https://docs.rs/condex

README

Condex


Extract tokens by simple condition expression.

CI Crates.io Licensed Twitter

| Docs | Latest Note |

[dependencies]
condex = "1.0.0"

Example


    #[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);
    
Commit count: 1

cargo fmt