Make formatter a bit more convenient

This commit is contained in:
2024-08-19 11:20:08 -03:00
parent 4a598a575b
commit 57e63f2308
4 changed files with 4 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ module Tartrazine
class Json < Formatter
property name = "json"
def format(text : String, lexer : Lexer, io : IO?) : String?
def format(text : String, lexer : Lexer, io : IO? = nil) : String?
outp = io.nil? ? String::Builder.new("") : io
tokenizer = Tokenizer.new(lexer, text)
outp << Tartrazine::Lexer.collapse_tokens(tokenizer.to_a).to_json