Parses Luau source code and returns a structured AST.
The returned root is an AstStatBlock node whose body contains
an array of statement nodes. Serialized AST nodes carry a category,
a lowercase type discriminator, and a 1-based source location.
Pass { collectComments = true } to include a comments array in the
result. Concrete syntax tokens are included directly on the AST and carry
text, location, leadingText, and trailingText.
local result = parse.parse(source, { collectComments = true })
print("Lines:", result.lines)
print("Errors:", #result.errors)
print("Top-level statements:", #result.root.body)