mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-01 13:11:11 +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_rules! log {
|
||||
(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();
|
||||
$output.flush().unwrap();
|
||||
}
|
||||
};
|
||||
($($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_rules! fmt_dbg {
|
||||
($arg: expr $(,)*) => {
|
||||
if cfg!(feature = "debug") { print!("{}:{}:\n", file!(), line!());
|
||||
if cfg!(feature = "debug") { print!("{}:{:4}:\n", file!(), line!());
|
||||
print!("{} = ", stringify!($arg));
|
||||
println!("{}", $arg);
|
||||
}
|
||||
};
|
||||
($head: expr, $($arg: expr,)+) => {
|
||||
if cfg!(feature = "debug") { print!("{}:{}:\n", file!(), line!());
|
||||
if cfg!(feature = "debug") { print!("{}:{:4}:\n", file!(), line!());
|
||||
print!("{} = ", stringify!($head));
|
||||
println!("{}", $head);
|
||||
$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