mirror of
https://github.com/uutils/awk.git
synced 2026-06-10 16:15:04 -07:00
parser: get formatting to match gawk 5.4.0
I was previously running into bugs cuz I was on the LTS lol.
This commit is contained in:
@@ -48,13 +48,14 @@ impl Display for Ast<'_> {
|
||||
write_body_ln(f, body, 0)?;
|
||||
writeln!(f)?;
|
||||
}
|
||||
for (fun, Function { args, body }) in &self.functions {
|
||||
// GNU appears to place two newlines before functions.
|
||||
// I think it's a bug but we'll keep it.
|
||||
write!(f, "\nfunction {fun}(")?;
|
||||
for (i, (fun, Function { args, body })) in self.functions.iter().enumerate() {
|
||||
write!(f, "function {fun}(")?;
|
||||
write_args(f, args, 0)?;
|
||||
writeln!(f, ") ")?;
|
||||
write_body_ln(f, body, 0)?;
|
||||
writeln!(f, ")")?;
|
||||
write_body(f, body, 0)?;
|
||||
if i + 1 != self.functions.len() {
|
||||
writeln!(f, "\n")?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user