Fix the parser, make the function name optional.

This commit is contained in:
2023-10-07 11:25:49 +02:00
parent 736d27953f
commit ca26d0ea40
4 changed files with 17 additions and 4 deletions

View File

@@ -33,7 +33,11 @@ where
TopLevel::Function(name, arg_names, body) => allocator
.text("function")
.append(allocator.space())
.append(allocator.text(name.to_string()))
.append(
name.as_ref()
.map(|x| allocator.text(x.to_string()))
.unwrap_or_else(|| allocator.nil()),
)
.append(
allocator
.intersperse(