Skip to content

parser

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

WARNING

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

Summary

EntryDescription
parseParses source as a complete Luau file and returns the full ParseResult, including the root block and EOF token.
parseBlockParses Luau source code into a CstStatBlock
parseExprParses source as a single Luau expression and returns the resulting CstExpr.

Functions and Properties

parser.parse

Parses source as a complete Luau file and returns the full ParseResult, including the root block and EOF token.

luau
(source: string) -> types.ParseResult

parser.parseBlock

Parses Luau source code into a CstStatBlock

luau
(source: string) -> types.CstStatBlock

parser.parseExpr

Parses source as a single Luau expression and returns the resulting CstExpr.

luau
(source: string) -> types.CstExpr