Skip to content

mutablecst ​

luau
local mutablecst = require("@lute/syntax/mutablecst")

WARNING

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

Summary ​

EntryDescription
CstAttributeA function attribute node (@checked, @native, or @deprecated).
CstElseIfExprAn elseif clause in an if-else expression.
CstElseIfStatAn elseif clause in an if statement.
CstEofThe end-of-file token.
CstExprUnion of all expression node types in the Luau CST.
CstExprBinaryA binary expression node (e.g., a + b).
CstExprCallA function call expression node.
CstExprConstantBoolA boolean literal node (true or false).
CstExprConstantIntegerAn integer literal node.
CstExprConstantNilA nil literal node.
CstExprConstantNumberA number literal node.
CstExprConstantStringA string literal node.
CstExprFunctionAn anonymous function expression node.
CstExprGlobalA reference to a global variable.
CstExprGroupA parenthesized expression node.
CstExprIfElseAn if-else expression node.
CstExprIndexExprA bracketed index expression node (e.g., t[k]).
CstExprIndexNameA dot or colon index expression node (e.g., t.k or t:method).
CstExprInstantiateAn explicit generic instantiation expression node (e.g., f<<T>>).
CstExprInterpStringAn interpolated string expression node (e.g., `hello {name}`).
CstExprLocalA reference to a local variable.
CstExprTableA table constructor expression node.
CstExprTypeAssertionA type assertion expression node (e.g., x :: T).
CstExprUnaryA unary expression node (e.g., not x, -x, #x).
CstExprVarargsA varargs expression node (...).
CstFunctionTypeParameterA parameter in a function type annotation.
CstGenericTypeA generic type parameter (e.g., T in function f<T>).
CstGenericTypePackA generic type pack parameter (e.g., T... in function f<T...>).
CstLocalA local variable binding site in the CST.
CstNodeUnion of all node types in the Luau CST.
CstParseResultThe result of parsing a Luau script, containing the root block, EOF token, and source location info.
CstStatUnion of all statement node types in the Luau CST.
CstStatAssignAn assignment statement node.
CstStatBlockA block statement node (a sequence of statements).
CstStatBreakA break statement node.
CstStatCompoundAssignA compound assignment statement node (e.g., x += 1).
CstStatConstA const variable declaration statement node.
CstStatContinueA continue statement node.
CstStatDoA do...end block statement node.
CstStatExprA statement consisting of a bare expression (e.g., a function call used as a statement).
CstStatForA numeric for loop statement node.
CstStatForInA generic for...in loop statement node.
CstStatFunctionA function declaration statement node.
CstStatIfAn if...then...elseif...else...end statement node.
CstStatLocalA local variable declaration statement node.
CstStatLocalFunctionA local function declaration statement node.
CstStatRepeatA repeat...until loop statement node.
CstStatReturnA return statement node.
CstStatTypeAliasA type alias declaration statement node.
CstStatTypeFunctionA type function declaration statement node.
CstStatWhileA while...do...end loop statement node.
CstTableExprGeneralItemA table constructor entry with a computed key (e.g., [expr] = value).
CstTableExprItemUnion of all table constructor entry types.
CstTableExprListItemA positional table constructor entry (e.g., value in { value }).
CstTableExprRecordItemA named table constructor entry (e.g., key = value).
CstTableTypeItemUnion of all table type entry kinds.
CstTableTypeItemIndexerA computed-key indexer entry in a table type (e.g., [K]: V).
CstTableTypeItemPropertyA named property entry in a table type (e.g., key: T).
CstTypeUnion of all type annotation node types in the Luau CST.
CstTypeArrayAn array type annotation node (e.g., { T }).
CstTypeFunctionA function type annotation node.
CstTypeGroupA parenthesized type annotation node.
CstTypeIntersectionAn intersection type annotation node (e.g., A & B).
CstTypeOptionalAn optional type annotation node (e.g., T?).
CstTypePackUnion of all type pack annotation node types in the Luau CST.
CstTypePackExplicitAn explicit type pack annotation node (e.g., (T, U)).
CstTypePackGenericA generic type pack annotation node (e.g., T...).
CstTypePackVariadicA variadic type pack annotation node (e.g., ...T).
CstTypeReferenceA named type reference node (e.g., string, MyType<T>).
CstTypeSingletonBoolA boolean singleton type node (true or false).
CstTypeSingletonStringA string singleton type node (e.g., "hello").
CstTypeTableA table type annotation node.
CstTypeTypeofA typeof(expr) type annotation node.
CstTypeUnionA union type annotation node (e.g., `A
MultiLineCommentA multi-line block comment trivia token (--[[...]]).
SingleLineCommentA single-line comment trivia token (--).
SpanA source location range, defined by begin and end line/column positions.
TriviaTrivia attached to a token: whitespace or comments.
WhitespaceA whitespace trivia token.

Types ​

CstAttribute ​

A function attribute node (@checked, @native, or @deprecated).

luau
type CstAttribute = {
	location: Span,
	kind: "attribute",
	name: CstToken<"@checked" | "@native" | "@deprecated">,
}

CstElseIfExpr ​

An elseif clause in an if-else expression.

luau
type CstElseIfExpr = {
	elseIfKeyword: CstToken<"elseif">,
	localKeyword: CstToken<"local" | "const">?,
	conditionLocal: CstLocal?,
	equals: CstToken<"=">?,
	condition: CstExpr,
	thenKeyword: CstToken<"then">,
	thenExpr: CstExpr,
}

CstElseIfStat ​

An elseif clause in an if statement.

luau
type CstElseIfStat = {
	elseIfKeyword: CstToken<"elseif">,
	localKeyword: CstToken<"local" | "const">?,
	conditionLocal: CstLocal?,
	equals: CstToken<"=">?,
	condition: CstExpr,
	thenKeyword: CstToken<"then">,
	thenBlock: CstStatBlock,
}

CstEof ​

The end-of-file token.

luau
type CstEof = CstToken<""> & { tag: "eof" }

CstExpr ​

Union of all expression node types in the Luau CST.

luau
type CstExpr =

CstExprBinary ​

A binary expression node (e.g., a + b).

luau
type CstExprBinary = {
	location: Span,
	kind: "expr",
	tag: "binary",
	lhsOperand: CstExpr,
	operator: CstToken,
	rhsOperand: CstExpr,
}

CstExprCall ​

A function call expression node.

luau
type CstExprCall = {
	location: Span,
	kind: "expr",
	tag: "call",
	func: CstExpr,
	openParens: CstToken<"(">?,
	arguments: CstPunctuated<CstExpr>,
	closeParens: CstToken<")">?,
	self: boolean,
	argLocation: Span,
}

CstExprConstantBool ​

A boolean literal node (true or false).

luau
type CstExprConstantBool = {
	location: Span,
	kind: "expr",
	tag: "boolean",
	value: boolean,
	token: CstToken<"true" | "false">,
}

CstExprConstantInteger ​

An integer literal node.

luau
type CstExprConstantInteger = {
	location: Span,
	kind: "expr",
	tag: "integer",
	value: number,
	token: CstToken<string>,
}

CstExprConstantNil ​

A nil literal node.

luau
type CstExprConstantNil = {
	location: Span,
	kind: "expr",
	tag: "nil",
	token: CstToken<"nil">,
}

CstExprConstantNumber ​

A number literal node.

luau
type CstExprConstantNumber = {
	location: Span,
	kind: "expr",
	tag: "number",
	value: number,
	token: CstToken<string>,
}

CstExprConstantString ​

A string literal node.

luau
type CstExprConstantString = {
	location: Span,
	kind: "expr",
	tag: "string",
	quoteStyle: "single" | "double" | "block" | "interp",
	blockDepth: number,
	value: CstToken<string>,
}

CstExprFunction ​

An anonymous function expression node.

luau
type CstExprFunction = {
	location: Span,
	kind: "expr",
	tag: "function",
	attributes: { CstAttribute },
	functionKeyword: CstToken<"function">,
	openGenerics: CstToken<"<">?,
	generics: CstPunctuated<CstGenericType>,
	genericPacks: CstPunctuated<CstGenericTypePack>,
	closeGenerics: CstToken<">">?,
	openParens: CstToken<"(">,
	self: CstLocal?,
	parameters: CstPunctuated<CstLocal>,
	hasVararg: boolean, -- Present so AstExprFunction subtypes structurally against CstExprFunction
	vararg: CstToken<"...">?,
	varargColon: CstToken<":">?,
	varargAnnotation: CstTypePack?,
	closeParens: CstToken<")">,
	returnSpecifier: CstToken<":">?,
	returnAnnotation: CstTypePack?,
	body: CstStatBlock,
	endKeyword: CstToken<"end">,
}

CstExprGlobal ​

A reference to a global variable.

luau
type CstExprGlobal = { location: Span, kind: "expr", tag: "global", name: CstToken }

CstExprGroup ​

A parenthesized expression node.

luau
type CstExprGroup = {
	location: Span,
	kind: "expr",
	tag: "group",
	openParens: CstToken<"(">,
	expression: CstExpr,
	closeParens: CstToken<")">,
}

CstExprIfElse ​

An if-else expression node.

luau
type CstExprIfElse = {
	location: Span,
	kind: "expr",
	tag: "conditional",
	ifKeyword: CstToken<"if">,
	localKeyword: CstToken<"local" | "const">?,
	conditionLocal: CstLocal?,
	equals: CstToken<"=">?,
	condition: CstExpr,
	thenKeyword: CstToken<"then">,
	thenExpr: CstExpr,
	elseifs: { CstElseIfExpr },
	elseKeyword: CstToken<"else">,
	elseExpr: CstExpr,
}

CstExprIndexExpr ​

A bracketed index expression node (e.g., t[k]).

luau
type CstExprIndexExpr = {
	location: Span,
	kind: "expr",
	tag: "index",
	expression: CstExpr,
	openBrackets: CstToken<"[">,
	index: CstExpr,
	closeBrackets: CstToken<"]">,
}

CstExprIndexName ​

A dot or colon index expression node (e.g., t.k or t:method).

luau
type CstExprIndexName = {
	location: Span,
	kind: "expr",
	tag: "indexname",
	expression: CstExpr,
	accessor: CstToken<"." | ":">,
	index: CstToken<string>,
	indexLocation: Span,
}

CstExprInstantiate ​

An explicit generic instantiation expression node (e.g., f<<T>>).

luau
type CstExprInstantiate = {
	location: Span,
	kind: "expr",
	tag: "instantiate",
	expr: CstExpr,
	leftArrow1: CstToken<"<">,
	leftArrow2: CstToken<"<">,
	typeArguments: CstPunctuated<CstType | CstTypePack>,
	rightArrow1: CstToken<">">,
	rightArrow2: CstToken<">">,
}

CstExprInterpString ​

An interpolated string expression node (e.g., `hello {name}`).

luau
type CstExprInterpString = {
	location: Span,
	kind: "expr",
	tag: "interpolatedstring",
	strings: { CstToken<string> },
	expressions: { CstExpr },
}

CstExprLocal ​

A reference to a local variable.

luau
type CstExprLocal = {
	location: Span,
	kind: "expr",
	tag: "local",
	token: CstToken<string>,
	["local"]: CstLocal,
	upvalue: boolean,
}

CstExprTable ​

A table constructor expression node.

luau
type CstExprTable = {
	location: Span,
	kind: "expr",
	tag: "table",
	openBrace: CstToken<"{">,
	entries: { CstTableExprItem },
	closeBrace: CstToken<"}">,
}

CstExprTypeAssertion ​

A type assertion expression node (e.g., x :: T).

luau
type CstExprTypeAssertion = {
	location: Span,
	kind: "expr",
	tag: "cast",
	operand: CstExpr,
	operator: CstToken<"::">,
	annotation: CstType,
}

CstExprUnary ​

A unary expression node (e.g., not x, -x, #x).

luau
type CstExprUnary = {
	location: Span,
	kind: "expr",
	tag: "unary",
	operator: CstToken<"not" | "-" | "#">,
	operand: CstExpr,
}

CstExprVarargs ​

A varargs expression node (...).

luau
type CstExprVarargs = {
	location: Span,
	kind: "expr",
	tag: "vararg",
	token: CstToken<"...">,
}

CstFunctionTypeParameter ​

A parameter in a function type annotation.

luau
type CstFunctionTypeParameter = {
	name: CstToken?,
	colon: CstToken<":">?,
	type: CstType,
}

CstGenericType ​

A generic type parameter (e.g., T in function f<T>).

luau
type CstGenericType = {
	tag: "generic",
	name: CstToken<string>,
	equals: CstToken<"=">?,
	default: CstType?,
}

CstGenericTypePack ​

A generic type pack parameter (e.g., T... in function f<T...>).

luau
type CstGenericTypePack = {
	tag: "genericpack",
	name: CstToken<string>,
	ellipsis: CstToken<"...">,
	equals: CstToken<"=">?,
	default: CstTypePack?,
}

CstLocal ​

A local variable binding site in the CST.

luau
type CstLocal = {
	location: Span,
	kind: "local",
	name: CstToken<string>,
	colon: CstToken<":">?,
	annotation: CstType?,
	shadows: CstLocal?,
}

CstNode ​

Union of all node types in the Luau CST.

luau
type CstNode = CstExpr | CstStat | CstType | CstTypePack | CstLocal | CstAttribute | CstToken

CstParseResult ​

The result of parsing a Luau script, containing the root block, EOF token, and source location info.

luau
type CstParseResult = {
	root: CstStatBlock,
	eof: CstEof,
	lines: number,
	lineOffsets: { number },
}

CstStat ​

Union of all statement node types in the Luau CST.

luau
type CstStat =

CstStatAssign ​

An assignment statement node.

luau
type CstStatAssign = {
	location: Span,
	kind: "stat",
	tag: "assign",
	variables: CstPunctuated<CstExpr>,
	equals: CstToken<"=">,
	values: CstPunctuated<CstExpr>,
}

CstStatBlock ​

A block statement node (a sequence of statements).

luau
type CstStatBlock = {
	location: Span,
	kind: "stat",
	tag: "block",
	statements: { CstStat },
}

CstStatBreak ​

A break statement node.

luau
type CstStatBreak = { location: Span, kind: "stat", tag: "break", token: CstToken<"break"> }

CstStatCompoundAssign ​

A compound assignment statement node (e.g., x += 1).

luau
type CstStatCompoundAssign = {
	location: Span,
	kind: "stat",
	tag: "compoundassign",
	variable: CstExpr,
	operator: CstToken, -- TODO: Enforce token type
	value: CstExpr,
}

CstStatConst ​

A const variable declaration statement node.

luau
type CstStatConst = {
	location: Span,
	kind: "stat",
	tag: "const",
	constKeyword: CstToken<"const">,
	variables: CstPunctuated<CstLocal>,
	equals: CstToken<"=">?,
	values: CstPunctuated<CstExpr>,
}

CstStatContinue ​

A continue statement node.

luau
type CstStatContinue = {
	location: Span,
	kind: "stat",
	tag: "continue",
	token: CstToken<"continue">,
}

CstStatDo ​

A do...end block statement node.

luau
type CstStatDo = {
	location: Span,
	kind: "stat",
	tag: "do",
	doKeyword: CstToken<"do">,
	body: CstStatBlock,
	endKeyword: CstToken<"end">,
}

CstStatExpr ​

A statement consisting of a bare expression (e.g., a function call used as a statement).

luau
type CstStatExpr = {
	location: Span,
	kind: "stat",
	tag: "expression",
	expression: CstExpr,
}

CstStatFor ​

A numeric for loop statement node.

luau
type CstStatFor = {
	location: Span,
	kind: "stat",
	tag: "for",
	forKeyword: CstToken<"for">,
	variable: CstLocal,
	equals: CstToken<"=">,
	from: CstExpr,
	toComma: CstToken<",">,
	to: CstExpr,
	stepComma: CstToken<",">?,
	step: CstExpr?,
	doKeyword: CstToken<"do">,
	body: CstStatBlock,
	endKeyword: CstToken<"end">,
}

CstStatForIn ​

A generic for...in loop statement node.

luau
type CstStatForIn = {
	location: Span,
	kind: "stat",
	tag: "forin",
	forKeyword: CstToken<"for">,
	variables: CstPunctuated<CstLocal>,
	inKeyword: CstToken<"in">,
	values: CstPunctuated<CstExpr>,
	doKeyword: CstToken<"do">,
	body: CstStatBlock,
	endKeyword: CstToken<"end">,
}

CstStatFunction ​

A function declaration statement node.

luau
type CstStatFunction = {
	location: Span,
	kind: "stat",
	tag: "function",
	name: CstExpr,
	func: CstExprFunction,
}

CstStatIf ​

An if...then...elseif...else...end statement node.

luau
type CstStatIf = {
	location: Span,
	kind: "stat",
	tag: "conditional",
	ifKeyword: CstToken<"if">,
	localKeyword: CstToken<"local" | "const">?,
	conditionLocal: CstLocal?,
	equals: CstToken<"=">?,
	condition: CstExpr,
	thenKeyword: CstToken<"then">,
	thenBlock: CstStatBlock,
	elseifs: { CstElseIfStat },
	elseKeyword: CstToken<"else">?, -- TODO: This could be elseif!
	elseBlock: CstStatBlock?,
	endKeyword: CstToken<"end">,
}

CstStatLocal ​

A local variable declaration statement node.

luau
type CstStatLocal = {
	location: Span,
	kind: "stat",
	tag: "local",
	localKeyword: CstToken<"local">,
	variables: CstPunctuated<CstLocal>,
	equals: CstToken<"=">?,
	values: CstPunctuated<CstExpr>,
}

CstStatLocalFunction ​

A local function declaration statement node.

luau
type CstStatLocalFunction = {
	location: Span,
	kind: "stat",
	tag: "localfunction",
	localKeyword: CstToken<"local">,
	name: CstLocal,
	func: CstExprFunction,
}

CstStatRepeat ​

A repeat...until loop statement node.

luau
type CstStatRepeat = {
	location: Span,
	kind: "stat",
	tag: "repeat",
	repeatKeyword: CstToken<"repeat">,
	body: CstStatBlock,
	untilKeyword: CstToken<"until">,
	condition: CstExpr,
}

CstStatReturn ​

A return statement node.

luau
type CstStatReturn = {
	location: Span,
	kind: "stat",
	tag: "return",
	returnKeyword: CstToken<"return">,
	expressions: CstPunctuated<CstExpr>,
}

CstStatTypeAlias ​

A type alias declaration statement node.

luau
type CstStatTypeAlias = {
	location: Span,
	kind: "stat",
	tag: "typealias",
	isExported: boolean,
	export: CstToken<"export">?,
	typeToken: CstToken<"type">,
	name: CstToken,
	openGenerics: CstToken<"<">?,
	generics: CstPunctuated<CstGenericType>?,
	genericPacks: CstPunctuated<CstGenericTypePack>?,
	closeGenerics: CstToken<">">?,
	equals: CstToken<"=">,
	type: CstType,
}

CstStatTypeFunction ​

A type function declaration statement node.

luau
type CstStatTypeFunction = {
	location: Span,
	kind: "stat",
	tag: "typefunction",
	isExported: boolean,
	export: CstToken<"export">?,
	type: CstToken<"type">,
	name: CstToken,
	body: CstExprFunction,
}

CstStatWhile ​

A while...do...end loop statement node.

luau
type CstStatWhile = {
	location: Span,
	kind: "stat",
	tag: "while",
	whileKeyword: CstToken<"while">,
	condition: CstExpr,
	doKeyword: CstToken<"do">,
	body: CstStatBlock,
	endKeyword: CstToken<"end">,
}

CstTableExprGeneralItem ​

A table constructor entry with a computed key (e.g., [expr] = value).

luau
type CstTableExprGeneralItem = {
	location: Span,
	kind: "general",
	indexerOpen: CstToken<"[">,
	key: CstExpr,
	indexerClose: CstToken<"]">,
	equals: CstToken<"=">,
	value: CstExpr,
	separator: CstToken<"," | ";">?,
	isTableItem: true,
}

CstTableExprItem ​

Union of all table constructor entry types.

luau
type CstTableExprItem = CstTableExprListItem | CstTableExprRecordItem | CstTableExprGeneralItem

CstTableExprListItem ​

A positional table constructor entry (e.g., value in { value }).

luau
type CstTableExprListItem = {
	location: Span,
	kind: "list",
	value: CstExpr,
	separator: CstToken<"," | ";">?,
	isTableItem: true,
}

CstTableExprRecordItem ​

A named table constructor entry (e.g., key = value).

luau
type CstTableExprRecordItem = {
	location: Span,
	kind: "record",
	key: CstToken<string>,
	equals: CstToken<"=">,
	value: CstExpr,
	separator: CstToken<"," | ";">?,
	isTableItem: true,
}

CstTableTypeItem ​

Union of all table type entry kinds.

luau
type CstTableTypeItem = CstTableTypeItemIndexer | CstTableTypeItemProperty

CstTableTypeItemIndexer ​

A computed-key indexer entry in a table type (e.g., [K]: V).

luau
type CstTableTypeItemIndexer = {
	kind: "indexer",
	access: CstToken<"read" | "write">?,
	indexerOpen: CstToken<"[">,
	key: CstType,
	indexerClose: CstToken<"]">,
	colon: CstToken<":">,
	value: CstType,
	separator: CstToken<"," | ";">?,
}

CstTableTypeItemProperty ​

A named property entry in a table type (e.g., key: T).

luau
type CstTableTypeItemProperty = {
	kind: "property",
	access: CstToken<"read" | "write">?,
	indexerOpen: CstToken<"[">?,
	quoteStyle: ("single" | "double")?,
	key: CstToken,
	indexerClose: CstToken<"]">?,
	colon: CstToken<":">,
	value: CstType,
	separator: CstToken<"," | ";">?,
}

CstType ​

Union of all type annotation node types in the Luau CST.

luau
type CstType =

CstTypeArray ​

An array type annotation node (e.g., { T }).

luau
type CstTypeArray = {
	location: Span,
	kind: "type",
	tag: "array",
	openBrace: CstToken<"{">,
	access: CstToken<"read" | "write">?,
	type: CstType,
	closeBrace: CstToken<"}">,
}

CstTypeFunction ​

A function type annotation node.

luau
type CstTypeFunction = {
	location: Span,
	kind: "type",
	tag: "function",
	openGenerics: CstToken<"<">?,
	generics: CstPunctuated<CstGenericType>?,
	genericPacks: CstPunctuated<CstGenericTypePack>?,
	closeGenerics: CstToken<">">?,
	openParens: CstToken<"(">,
	parameters: CstPunctuated<CstFunctionTypeParameter>,
	vararg: CstTypePack?,
	closeParens: CstToken<")">,
	returnArrow: CstToken<"->">,
	returnTypes: CstTypePack,
}

CstTypeGroup ​

A parenthesized type annotation node.

luau
type CstTypeGroup = {
	location: Span,
	kind: "type",
	tag: "group",
	openParens: CstToken<"(">,
	type: CstType,
	closeParens: CstToken<")">,
}

CstTypeIntersection ​

An intersection type annotation node (e.g., A & B).

luau
type CstTypeIntersection = {
	location: Span,
	kind: "type",
	tag: "intersection",
	leading: CstToken<"&">?,
	types: CstPunctuated<CstType, "&">,
}

CstTypeOptional ​

An optional type annotation node (e.g., T?).

luau
type CstTypeOptional =

CstTypePack ​

Union of all type pack annotation node types in the Luau CST.

luau
type CstTypePack = CstTypePackExplicit | CstTypePackGeneric | CstTypePackVariadic

CstTypePackExplicit ​

An explicit type pack annotation node (e.g., (T, U)).

luau
type CstTypePackExplicit = {
	location: Span,
	kind: "typepack",
	tag: "explicit",
	openParens: CstToken<"(">?,
	types: CstPunctuated<CstType>,
	tailType: CstTypePack?,
	closeParens: CstToken<")">?,
}

CstTypePackGeneric ​

A generic type pack annotation node (e.g., T...).

luau
type CstTypePackGeneric = {
	location: Span,
	kind: "typepack",
	tag: "generic",
	name: CstToken,
	ellipsis: CstToken<"...">,
}

CstTypePackVariadic ​

A variadic type pack annotation node (e.g., ...T).

luau
type CstTypePackVariadic = {
	location: Span,
	kind: "typepack",
	tag: "variadic",
	--- May be nil when present as the vararg annotation in a function body
	ellipsis: CstToken<"...">?,
	type: CstType,
}

CstTypeReference ​

A named type reference node (e.g., string, MyType<T>).

luau
type CstTypeReference = {
	location: Span,
	kind: "type",
	tag: "reference",
	prefix: CstToken<string>?,
	prefixPoint: CstToken<".">?,
	name: CstToken<string>,
	openParameters: CstToken<"<">?,
	parameters: CstPunctuated<CstType | CstTypePack>?,
	closeParameters: CstToken<">">?,
}

CstTypeSingletonBool ​

A boolean singleton type node (true or false).

luau
type CstTypeSingletonBool = {
	location: Span,
	kind: "type",
	tag: "boolean",
	value: boolean,
	token: CstToken<"true" | "false">,
}

CstTypeSingletonString ​

A string singleton type node (e.g., "hello").

luau
type CstTypeSingletonString = {
	location: Span,
	kind: "type",
	tag: "string",
	quoteStyle: "single" | "double",
	value: CstToken<string>,
}

CstTypeTable ​

A table type annotation node.

luau
type CstTypeTable = {
	location: Span,
	kind: "type",
	tag: "table",
	openBrace: CstToken<"{">,
	entries: { CstTableTypeItem },
	closeBrace: CstToken<"}">,
}

CstTypeTypeof ​

A typeof(expr) type annotation node.

luau
type CstTypeTypeof = {
	location: Span,
	kind: "type",
	tag: "typeof",
	typeof: CstToken<"typeof">,
	openParens: CstToken<"(">,
	expression: CstExpr,
	closeParens: CstToken<")">,
}

CstTypeUnion ​

A union type annotation node (e.g., A | B).

luau
type CstTypeUnion = {
	location: Span,
	kind: "type",
	tag: "union",
	leading: CstToken<"|">?,
	-- Separator may be nil for CstTypeOptional
	types: CstPunctuated<CstType, "|">,
}

MultiLineComment ​

A multi-line block comment trivia token (--[[...]]).

luau
type MultiLineComment = {
	tag: "blockcomment",
	location: Span,
	text: string,
	-- TODO: depth: number,
}

SingleLineComment ​

A single-line comment trivia token (--).

luau
type SingleLineComment = {
	tag: "comment",
	location: Span,
	text: string,
}

Span ​

A source location range, defined by begin and end line/column positions.

luau
type Span = setmetatable<SpanData, SpanMT>

Trivia ​

Trivia attached to a token: whitespace or comments.

luau
type Trivia = Whitespace | SingleLineComment | MultiLineComment

Whitespace ​

A whitespace trivia token.

luau
type Whitespace = {
	tag: "whitespace",
	location: Span,
	text: string,
}