string-parser

Crates.iostring-parser
lib.rsstring-parser
version0.1.8
sourcesrc
created_at2020-07-10 11:43:35.254807
updated_at2020-07-18 17:27:37.285454
descriptionString parsing crate
homepage
repositoryhttps://github.com/ProbablyClem/string_parser
max_upload_size
id263606
size9,387
Clément Guiton (ProbablyClem)

documentation

README

string_parser

Rust string parsing crate

Doc : https://crates.io/crates/string-parser

Usage :

use std::rc::Rc;
extern crate string_parser;
use string_parser::Parser; 
 
fn end_filter(c : Vec<char>) -> bool{            
    if c.last().unwrap()== &'\'' {
        return true;
        }
    else {
        return false;
        }   
}

//can also use closures
let callback = |s : String, line : usize, file : &str| {
    assert_eq!(String::from("foo"), s); 
};

let mut string_parser = Parser::new();

string_parser.add(String::from("'"), Rc::new(Box::from(end_filter)), Rc::new(Box::from(callback)));
string_parser.parse("./text");
Commit count: 20

cargo fmt