Crates.io | tinyparse |
lib.rs | tinyparse |
version | 0.2.3 |
source | src |
created_at | 2022-05-01 08:45:54.220839 |
updated_at | 2022-05-01 14:13:24.056976 |
description | A tiny combinator parser library. |
homepage | |
repository | https://github.com/Bitbot25/tinyparse |
max_upload_size | |
id | 578534 |
size | 17,513 |
A tiny library for parsing simple expressions.
use tinyparse::common;
use tinyparse::{Span, Parse};
let hello_or_int = common::literal("hello!").or(common::int());
// The parse functions return a result containing what's left of "10" and the actual result.
assert_eq!(hello_or_int.parse(Span::new("10")), Ok((Span::empty(), 10)));
Some expressions need lookahead capability or something similar to be parsed. Unfortunately; this library does not include this.If you want lookahead capability, consider implementing your own parser using the Parse
trait.