Skip to content

Extract tokens by simple condition expression.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT
Notifications You must be signed in to change notification settings

just-do-halee/condex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
    

About

Extract tokens by simple condition expression.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages