2023-03-23 23:35:32 +00:00
|
|
|
#![feature(round_char_boundary)]
|
2023-03-25 15:27:38 +00:00
|
|
|
use crate::parser::document;
|
2022-11-25 22:49:38 +00:00
|
|
|
use tracing::Level;
|
2022-11-25 22:54:26 +00:00
|
|
|
use tracing_subscriber::fmt::format::FmtSpan;
|
2022-07-16 03:26:49 +00:00
|
|
|
|
|
|
|
mod parser;
|
|
|
|
|
|
|
|
const TEST_DOC: &'static str = include_str!("../toy_language.txt");
|
|
|
|
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
2022-11-25 22:49:38 +00:00
|
|
|
let format = tracing_subscriber::fmt::format()
|
|
|
|
.with_file(true)
|
|
|
|
.with_line_number(true)
|
|
|
|
.with_thread_ids(false)
|
|
|
|
.with_target(false);
|
|
|
|
let subscriber = tracing_subscriber::fmt()
|
|
|
|
.event_format(format)
|
|
|
|
.with_max_level(Level::TRACE)
|
2022-11-25 22:54:26 +00:00
|
|
|
.with_span_events(FmtSpan::ENTER | FmtSpan::EXIT)
|
2022-11-25 22:49:38 +00:00
|
|
|
.finish();
|
2022-11-25 22:27:29 +00:00
|
|
|
tracing::subscriber::set_global_default(subscriber)?;
|
2023-03-25 15:27:38 +00:00
|
|
|
let parsed = document(TEST_DOC);
|
|
|
|
println!("{}\n\n\n", TEST_DOC);
|
|
|
|
println!("{:#?}", parsed);
|
2022-07-16 03:26:49 +00:00
|
|
|
Ok(())
|
|
|
|
}
|