galvan-pest 0.0.0-dev06

Parser for the Galvan language using pest-grammar
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use galvan_files::read_sources;
use std::{env, path::Path};

use crate::*;

pub fn parse_current_dir() -> Vec<(ParseResult<'static>, Source)> {
    let current_dir = env::current_dir().unwrap();
    parse_dir(current_dir)
}

pub fn parse_dir(path: impl AsRef<Path>) -> Vec<(ParseResult<'static>, Source)> {
    read_sources(path)
        .unwrap()
        .into_iter()
        .map(|s| (parse_source(Box::leak(Box::new(s.clone()))), s))
        .collect::<Vec<_>>()
    // TODO: Aggregate and print errors
}