ableos_userland/programs/aidl/src/main.rs

29 lines
500 B
Rust
Raw Normal View History

2023-05-04 11:50:17 -05:00
#![feature(result_option_inspect)]
2023-05-04 06:19:32 -05:00
#![allow(non_snake_case)]
2023-05-04 02:27:04 -05:00
2023-05-04 06:19:32 -05:00
mod ast;
mod lexer;
mod parser;
2023-05-04 02:27:04 -05:00
2023-05-04 07:44:49 -05:00
const TEST: &str = include_str!("../assets/why.idl");
2023-05-04 02:27:04 -05:00
fn main() {
2023-05-04 12:31:20 -05:00
let res = parser::parse(TEST);
2023-05-04 07:44:49 -05:00
match res {
2023-05-04 08:51:31 -05:00
Ok(ast) => {
2023-05-04 12:31:20 -05:00
println!("{:?}", ast);
2023-05-04 08:51:31 -05:00
}
Err(e) => println!("{}", e),
2023-05-04 07:44:49 -05:00
}
2023-05-04 06:19:32 -05:00
}
2023-05-04 02:27:04 -05:00
2023-05-04 06:19:32 -05:00
#[macro_export]
macro_rules! unwrap_match {
($x:expr, $m:pat => $a:expr) => {
match $x {
$m => $a,
2023-05-04 08:51:31 -05:00
_ => unreachable!(),
2023-05-04 06:19:32 -05:00
}
};
2023-05-04 02:27:04 -05:00
}