2 releases
0.1.1 | Oct 23, 2024 |
---|---|
0.1.0 | Oct 23, 2024 |
#1272 in Parser implementations
233 downloads per month
3KB
My parser
It is a simple parser for education purposes. It allows you to parse numbers in string format.
Examples
Parsing the correct list:
use my_parser_striletska::list_parser;
fn main() {
assert_eq!(list_parser::list("[1,1,2,3,5,8]"), Ok(vec![1, 1, 2, 3, 5, 8]));
}
Handling parsing errors:
use my_parser_striletska::list_parser;
fn main() {
let input = "[1,a]";
match list_parser::list(input) {
Ok(parsed) => println!("Parsed list: {:?}", parsed),
Err(err) => println!("Error: {:?}", err),
}
}
Dependencies
~145KB