A 1-based source position in the original input.
@eryx/luau/ast Module
Type stubs for the Luau AST shape produced by src/modules/luau/native.cpp.
API Reference
Types
Position
The 1-based source line number.
The 1-based source column number.
Location
A 1-based, half-open source span in the original input.
The 1-based line where the span begins.
The 1-based column where the span begins.
The 1-based line where the span ends.
The 1-based column where the span ends.
CstToken<Text>
A concrete syntax token captured from the CST.
Identifies this table as a concrete syntax token.
The exact source text of the token, including raw literal spelling such as 0x10.
The span of the token itself, excluding leading and trailing trivia.
Trivia immediately before this token, such as whitespace and comments.
Trivia immediately after this token, such as whitespace and comments.
AstNode<Category, Type>
Shared fields present on every serialized AST node.
The broad AST family this node belongs to.
The specific node kind within the category.
The source span covered by the AST node.
AstStatNode<Type>
Shared fields present on every statement node.
True when the statement was terminated by an explicit semicolon.
The trailing semicolon token after this statement, when one was present.
TableAccess
The read/write access qualifier for table and extern type entries.
AstLocal
A local binding referenced by declarations and local expressions.
The local variable name.
The identifier token that introduced or referenced this local.
The source span of the local identifier.
The local declaration shadowed by this local, if one exists.
The function nesting depth where the local is declared.
The loop nesting depth where the local is declared.
True when the local is const.
True when this local came from an exported declaration.
The type annotation attached to the local declaration.
TypeOrPack
A type argument item that can be either a type, a type pack, or an absent placeholder.
TypeList
A list of types with an optional trailing type pack.
Positional type entries.
The trailing type pack, when the list ends with one.
ArgumentName
The optional source name for a function parameter type.
The parameter name text.
The source span of the parameter name.
TableIndexer
A table indexer type, such as {[K]: V}.
The type used as the index key.
The type produced by the indexer.
The full source span of the indexer entry.
The optional read/write access mode.
The source span of the access qualifier, when present.
AstAttr
A function or declaration attribute such as @native or @deprecated.
The normalized attribute kind.
The attribute name without the @ prefix.
The attribute name token after @.
Attribute argument expressions inside the argument list.
Parsed @deprecated payload, when available.
AstGenericType
A named generic type parameter.
The generic parameter name.
The generic parameter identifier token.
The default type after =, when present.
The = token before the default type.
AstGenericTypePack
A named generic type-pack parameter.
The generic pack parameter name.
The generic pack identifier token.
The ... token that marks this generic as a type pack.
The default type pack after =, when present.
The = token before the default type pack.
AstExprGroup
A parenthesized expression.
The opening ( token.
The expression inside the parentheses.
The closing ) token.
AstExprConstantBool
A boolean literal expression.
The parsed boolean value.
The true or false keyword token.
AstExprConstantNumber
A floating point number literal expression.
The parsed numeric value.
The exact number literal token, preserving raw spelling.
AstExprConstantInteger
An integer literal expression.
The parsed integer value.
The exact integer literal token, preserving raw spelling.
AstExprConstantString
A string literal expression.
The decoded string value.
The serializer's description of the source quote style.
True when the literal was written with quotes in source.
The exact string literal token, preserving raw spelling.
AstExprLocal
A reference to a local binding.
The local binding object being referenced.
True when the referenced local is captured from an outer function.
The identifier token at this reference site.
AstExprGlobal
A reference to a global binding.
The global name.
The global identifier token.
AstExprCall
A function or method call expression.
The expression being called.
Explicit type arguments passed with <<...>>.
Runtime argument expressions.
True when this is a method-style self call.
The source span covering the argument syntax.
The first < token in an explicit << type argument list.
The second < token in an explicit << type argument list.
The first > token in an explicit >> type argument list.
The second > token in an explicit >> type argument list.
The opening ( token for parenthesized call arguments.
The closing ) token for parenthesized call arguments.
AstExprIndexName
A field or method-name indexing expression, such as a.b or a:b.
The table or object expression being indexed.
The field or method name.
The source span of the field or method name.
The source position of the . or : operator.
The . or : token.
The identifier token after the . or : operator.
AstExprIndexExpr
A bracket indexing expression, such as a[b].
The table or object expression being indexed.
The expression inside the brackets.
The opening [ token.
The closing ] token.
AstExprFunction
A function expression.
Attributes applied to the function.
Generic type parameters.
Generic type-pack parameters.
The implicit self local for method functions.
Function parameter locals.
The annotated return type pack.
True when the function accepts varargs.
The source span of the vararg marker.
The annotated vararg type pack.
The function body block.
The function nesting depth.
The debug name inferred by the parser.
The source span of the parameter list.
The function keyword token for full function expressions and declarations.
The opening < token for generic parameters.
The closing > token for generic parameters.
The opening ( token for the parameter list.
The closing ) token for the parameter list.
The ... token for vararg parameters.
The : token before the return annotation.
The end keyword token closing the function body.
AstExprTableItem
An item inside a table constructor.
The table item form: array item, name record, or bracketed key record.
The key expression for keyed entries.
The value expression stored in the table.
AstExprTable
A table constructor expression.
Table entries in source order.
The opening { token.
The closing } token.
AstExprUnary
A unary operator expression.
The normalized unary operator name.
The operand expression.
The unary operator token, such as not, -, or #.
AstExprBinary
A binary operator expression.
The normalized binary operator name.
The left operand.
The right operand.
The binary operator token, such as +, and, or ==.
AstExprTypeAssertion
A type assertion expression.
The expression being asserted.
The asserted type annotation.
The :: token.
AstExprIfElse
An if expression.
The condition expression.
The expression after then.
The expression after else.
The if token, or elseif token for chained branches represented as nested nodes.
The then keyword token.
The else or elseif keyword token.
AstExprInterpString
An interpolated string expression.
Literal string segments between interpolation holes.
Expressions inside interpolation holes.
AstExprInstantiate
An expression with explicit type instantiation.
The expression being instantiated.
The explicit type and type-pack arguments.
The first < token in the opening <<.
The second < token in the opening <<.
The first > token in the closing >>.
The second > token in the closing >>.
AstExprError
An expression placeholder produced for parse errors.
Child expressions retained by the parser around the error.
Index into the parser error list for the associated diagnostic.
The concrete source span token synthesized for the error range.
AstStatBlock
A statement block.
Statements in the block.
The zero-width end-of-file token for the root block, when emitted.
AstStatIf
An if statement.
The condition expression.
The block executed when the condition is truthy.
The else or elseif block.
The source span of the then keyword.
The source span of the else keyword.
The if keyword token. Nested elseif nodes omit this because their parent owns the elseif token.
The then keyword token.
The else or elseif keyword token.
The end keyword token closing the statement.
AstStatWhile
A while loop statement.
The loop condition expression.
The loop body block.
The source span of the do keyword.
The while keyword token.
The do keyword token.
The end keyword token closing the loop.
AstStatRepeat
A repeat-until loop statement.
The repeated body block.
The condition expression after until.
The repeat keyword token.
The until keyword token.
AstStatReturn
A return statement.
Returned expression list.
The return keyword token.
AstStatExpr
A statement that consists of a single expression.
The expression being used as a statement.
AstStatLocal
A local variable declaration statement.
Declared local bindings.
Initializer expressions after =.
True when the declaration uses const.
The source span of the = token.
The local or const declaration keyword token.
The = token before initializer expressions.
AstStatFor
A numeric for loop statement.
The loop variable local.
The initial value expression.
The limit value expression.
The optional step expression.
The loop body block.
The source span of the do keyword.
The for keyword token.
The = token after the loop variable.
The comma token between the initial and limit expressions.
The comma token before the step expression.
The do keyword token.
The end keyword token closing the loop.
AstStatForIn
A generic for-in loop statement.
Loop variable locals.
Iterator expressions after in.
The loop body block.
The source span of the in keyword.
The source span of the do keyword.
The for keyword token.
The in keyword token.
The do keyword token.
The end keyword token closing the loop.
AstStatAssign
An assignment statement.
Assignment target expressions.
Value expressions.
The = token between targets and values.
AstStatCompoundAssign
A compound assignment statement.
The normalized compound operator name.
The assignment target expression.
The value expression.
The compound assignment operator token, such as += or ..=.
AstStatFunction
A global or table function declaration statement.
The function name expression.
The function body expression node.
The function keyword token that starts the declaration.
AstStatLocalFunction
A local function declaration statement.
The declared local function binding.
The function body expression node.
True when the local function declaration is const.
The local keyword token.
The function keyword token.
The local function name identifier token.
AstStatTypeAlias
A type alias declaration statement.
The alias name.
The source span of the alias name.
Generic type parameters.
Generic type-pack parameters.
The aliased type.
True when this is an exported type alias.
The export keyword token.
The type keyword token.
The alias name identifier token.
The = token before the aliased type.
AstStatTypeFunction
A type function declaration statement.
The type function name.
The source span of the type function name.
The function body, when the parser produced one.
True when this is an exported type function.
True when the parser reported errors inside this declaration.
The export keyword token.
The type keyword token.
The function keyword token.
The type function name identifier token.
AstClassMember
A member entry in a class declaration.
AstStatClass
A class declaration statement.
The class local binding.
Class property and method members.
True when this is an exported class declaration.
The export keyword token.
The class keyword token.
The class name identifier token.
The end keyword token closing the class declaration.
AstStatDeclareGlobal
A declare global statement.
The declared global name.
The source span of the global name.
The declared global type.
The declare keyword token.
The global name identifier token.
The : token before the declared type.
AstStatDeclareFunction
A declare function statement.
Attributes applied to the declaration.
The declared function name.
The source span of the declared function name.
Generic type parameters.
Generic type-pack parameters.
Parameter types.
Optional parameter names.
True when the declaration accepts varargs.
The source span of the vararg marker.
Return type pack.
The declare keyword token.
The function keyword token.
The function name identifier token.
DeclaredExternTypeProperty
A property inside a declared extern type.
The extern property name.
The source span of the property name.
The property type.
True when the property is declared as a method.
The optional read/write access mode.
The full source span of the property declaration.
AstStatDeclareExternType
A declare extern type statement.
The declared extern type name.
The optional supertype name.
Declared properties.
Optional indexer declaration.
The declare keyword token.
The end keyword token closing the extern type.
AstStatError
A statement placeholder produced for parse errors.
Child expressions retained by the parser around the error.
Child statements retained by the parser around the error.
Index into the parser error list for the associated diagnostic.
The concrete source span token synthesized for the error range.
AstTypeReference
A named type reference, optionally with a prefix and type arguments.
True when source explicitly included a parameter list.
The referenced type name.
The source span of the referenced type name.
The optional prefix before a dot.
The source span of the optional prefix.
Type and type-pack arguments inside <...>.
The prefix identifier token before the dot.
The . token between prefix and name.
The referenced type name identifier token.
The opening < token for type parameters.
The closing > token for type parameters.
AstTypeTableProp
A named property inside a table type.
The property name.
The property type.
The full source span of the property entry.
The optional read/write access mode.
The source span of the access qualifier, when present.
AstTypeTable
A table type.
Named property entries.
Optional indexer entry.
The opening { token.
The closing } token.
AstTypeFunction
A function type.
Attributes applied to the function type.
Generic type parameters.
Generic type-pack parameters.
Argument type list.
Optional argument names paired with argument types.
Return type pack after ->.
The opening < token for generic parameters.
The closing > token for generic parameters.
The opening ( token for argument types.
The closing ) token for argument types.
The -> token before return types.
AstTypeTypeof
A typeof type expression.
The expression inside typeof(...).
The typeof keyword token.
The opening ( token.
The closing ) token.
AstTypeOptional
An optional type, such as T?.
The ? token after the base type.
AstTypeUnion
A union type.
Type branches in the union.
A leading | token when the union starts with one.
AstTypeIntersection
An intersection type.
Type branches in the intersection.
A leading & token when the intersection starts with one.
AstTypeError
A type placeholder produced for parse errors.
Child types retained by the parser around the error.
True when the type node represents a missing type.
Index into the parser error list for the associated diagnostic.
The concrete source span token synthesized for the error range.
AstTypeSingletonBool
A singleton boolean type.
The parsed boolean value.
The true or false token.
AstTypeSingletonString
A singleton string type.
The decoded string value.
The exact string literal token, preserving raw spelling.
AstTypeGroup
A parenthesized type.
The type inside the parentheses.
The opening ( token.
The closing ) token.
AstTypePackExplicit
An explicit type pack.
The contained type list.
The opening ( token around the pack.
The closing ) token around the pack.
AstTypePackVariadic
A variadic type pack.
The repeated type.
The ... token before or after the variadic type, depending on source form.
AstTypePackGeneric
A generic type-pack reference.
The generic pack name.
The generic pack identifier token.
The ... token associated with the generic pack spelling.
AstTypePackUnknown
An unknown type-pack placeholder.
The token that produced the unknown type pack.
AstTypeUnknown
An unknown type placeholder.
The token that produced the unknown type.
AstExpr
Any expression node emitted by the serializer.
AstStat
Any statement node emitted by the serializer.
AstType
Any type node emitted by the serializer.
AstTypePack
Any type-pack node emitted by the serializer.
AstAny
Any AST payload node emitted by the serializer.