mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-01 05:11:09 +00:00
Improve Parser
debugging display
This commit is contained in:
parent
7c27021e16
commit
cafc941b10
2 changed files with 366 additions and 141 deletions
|
@ -260,13 +260,13 @@ macro_rules! debug_enum_assert {
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! log {
|
macro_rules! log {
|
||||||
(f $output: ident, $($arg: tt)*) => {
|
(f $output: ident, $($arg: tt)*) => {
|
||||||
if cfg!(feature = "debug") { write!($output, "{}:{}: ", file!(), line!()).unwrap();
|
if cfg!(feature = "debug") { write!($output, "{}:{:4}: ", file!(), line!()).unwrap();
|
||||||
write!($output, $($arg)*).unwrap();
|
write!($output, $($arg)*).unwrap();
|
||||||
$output.flush().unwrap();
|
$output.flush().unwrap();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($($arg: tt)*) => {
|
($($arg: tt)*) => {
|
||||||
if cfg!(feature = "debug") { print!("{}:{}: ", file!(), line!()); println!($($arg)*); }
|
if cfg!(feature = "debug") { print!("{}:{:4}: ", file!(), line!()); println!($($arg)*); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,13 +290,13 @@ macro_rules! log_with_time {
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! fmt_dbg {
|
macro_rules! fmt_dbg {
|
||||||
($arg: expr $(,)*) => {
|
($arg: expr $(,)*) => {
|
||||||
if cfg!(feature = "debug") { print!("{}:{}:\n", file!(), line!());
|
if cfg!(feature = "debug") { print!("{}:{:4}:\n", file!(), line!());
|
||||||
print!("{} = ", stringify!($arg));
|
print!("{} = ", stringify!($arg));
|
||||||
println!("{}", $arg);
|
println!("{}", $arg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($head: expr, $($arg: expr,)+) => {
|
($head: expr, $($arg: expr,)+) => {
|
||||||
if cfg!(feature = "debug") { print!("{}:{}:\n", file!(), line!());
|
if cfg!(feature = "debug") { print!("{}:{:4}:\n", file!(), line!());
|
||||||
print!("{} = ", stringify!($head));
|
print!("{} = ", stringify!($head));
|
||||||
println!("{}", $head);
|
println!("{}", $head);
|
||||||
$crate::fmt_dbg!(rec $($arg,)+);
|
$crate::fmt_dbg!(rec $($arg,)+);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue