jean_io 0.1.0

I/O library feature for jean
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#[macro_export]
macro_rules! def_lexer {
  ($l:ident, $p:literal) => {
    use anyhow::Result;
    use pest::{iterators::Pairs, Parser};

    #[derive(Debug, Clone, Parser)]
    #[grammar = $p]
    pub struct $l;

    #[allow(dead_code)]
    impl $l {
      pub fn lex<'a>(str: &'a str) -> Result<Pairs<'a, Rule>> {
        $l::parse(Rule::file, str).map_err(|e| e.into())
      }
    }
  };
}