kohaku 0.1.3

A simple tokenizer that handles alphanumeric characters, underscore (`_`), whitespace, and some specified keywords.
Documentation
  • Coverage
  • 0%
    0 out of 5 items documented0 out of 4 items with examples
  • Size
  • Source code size: 14.0 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • mushitoriami/kohaku
    0 0 4
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mushitoriami

kohaku

A simple tokenizer that handles alphanumeric characters, underscore (_), whitespace, and some specified keywords.

let mut tokenizer = kohaku::Tokenizer::new(["->", "<-", "{", "}"]);

assert_eq!(
    tokenizer
        .tokenize("{abc -> 123}")
        .collect::<Vec<Result<&str, usize>>>(),
    [Ok("{"), Ok("abc"), Ok("->"), Ok("123"), Ok("}")]
);

assert_eq!(
    tokenizer
        .tokenize("{abc -> 1-3}")
        .collect::<Vec<Result<&str, usize>>>(),
    [Ok("{"), Ok("abc"), Ok("->"), Ok("1"), Err(10)]
);