1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#[macro_use]
extern crate lazy_static;
mod parser;
pub use parser::*;
use std::error::Error;
use std::fs;
pub use parser::parse_source;
pub use parser::statement::parse_statement;
pub fn print_ast(filename: &str) -> Result<(), Box<dyn Error>> {
let source: String = fs::read_to_string(filename)?;
println!("{:#?}", parse_source(Span::new(source.as_str())));
Ok(())
}
#[test]
fn test_parser() -> Result<(), Box<dyn Error>> {
let source: String = fs::read_to_string("examples/class.lv")?;
let _ = parse_source(Span::new(source.as_str()));
Ok(())
}