galvan-parse 0.0.3

The parsing crate for the compiler of the Galvan programming language
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, Source)> {
    let current_dir = env::current_dir().unwrap();
    parse_dir(current_dir)
}

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