More parsing debugging changes
This commit is contained in:
parent
bf3dcc18d0
commit
aae2ee53cd
10
schala-lang/language/src/debugging.rs
Normal file
10
schala-lang/language/src/debugging.rs
Normal file
@ -0,0 +1,10 @@
|
||||
use crate::ast::*;
|
||||
|
||||
impl AST {
|
||||
pub fn compact_debug(&self) -> String {
|
||||
format!("{:?}", self)
|
||||
}
|
||||
pub fn expanded_debug(&self) -> String {
|
||||
format!("{:#?}", self)
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@ macro_rules! bx {
|
||||
mod util;
|
||||
#[macro_use]
|
||||
mod typechecking;
|
||||
mod debugging;
|
||||
|
||||
mod tokenizing;
|
||||
mod ast;
|
||||
|
@ -103,12 +103,12 @@ fn parsing(input: Vec<tokenizing::Token>, handle: &mut Schala, comp: Option<&mut
|
||||
comp.map(|comp| {
|
||||
let debug_format = comp.parsing.as_ref().unwrap_or(&CompactAST);
|
||||
let debug_info = match debug_format {
|
||||
CompactAST => match ast {
|
||||
Ok(ref ast) => format!("{:?}", ast),
|
||||
CompactAST => match ast{
|
||||
Ok(ref ast) => ast.compact_debug(),
|
||||
Err(_) => "Error - see output".to_string(),
|
||||
},
|
||||
ExpandedAST => match ast {
|
||||
Ok(ref ast) => format!("{:#?}", ast),
|
||||
ExpandedAST => match ast{
|
||||
Ok(ref ast) => ast.expanded_debug(),
|
||||
Err(_) => "Error - see output".to_string(),
|
||||
},
|
||||
Trace => parser.format_parse_trace(),
|
||||
|
Loading…
Reference in New Issue
Block a user