Skip to content

mrMiiao/blocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

blocks

blocks is a simple left-to-right parser of balanced blocks.

Example:

use blocks::Blocks;

let code = "[[]]";
let mut blocks = Blocks::new();

for (n, c) in code.chars().enumerate() {
    match c {
        '[' => blocks.add_left(n),
        ']' => blocks.add_right(n)?,
        _ => unreachable!()
    }
}

let blocks = blocks.consume()?;

for block in blocks {
    println!("{:?}", block);
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages