Skip to content

printer

luau
local printer = require("@std/syntax/printer")

WARNING

These APIs are still open to future evolution. In new major versions, they may change in backwards incompatible ways.

Summary

EntryDescription
printFileReturns an entire parsed file as source text, including the EOF token, optionally applying replacements.
printNodeReturns node as source text, optionally applying replacements to substitute specific nodes with new text.

Functions and Properties

printer.printFile

Returns an entire parsed file as source text, including the EOF token, optionally applying replacements.

luau
(result: types.ParseResult, replacements: types.Replacements?) -> string

printer.printNode

Returns node as source text, optionally applying replacements to substitute specific nodes with new text.

luau
(node: types.CstNode, replacements: types.Replacements?) -> string