Module types

Source
Expand description

§Types module

This just reexports the struct and traits for easier importing.

§Note

This file only contains the definitions for items, for actual implementations, check the files under src/impl. Each type will have it’s implementation in the same place, ex. types in types/value/function.rs will have their implementations in impl/value/function.rs. The only impl here is for Statement, and it isn’t exposed directly to consumers of this crate, but rather through other functions.

Structs§

Attribute
An attribute that can be placed before a function.
Block
A block of code that represents a single scope (and nested ones).
Bracketed
An item that must be surrounded by brackets.
Closure
All possible arguments that can be passed to a function.
Comment
A comment.
CompoundSetExpression
A struct representing a set expression.
Cst
A struct representing a scope in a file. This CST is lossless, meaning it can be printed back to the code it was created from without losing any details.
DoBlock
A struct representing a do statement
ElseIfExpression
A struct representing an elseif expression, only exists in expressions.
ElseIfStatement
A struct representing an elseif statement
ElseStatement
A struct representing an else statement
FunctionCall
A struct representing a function call.
GenericDeclarationParameter
A generic declaration parameter used in generic declarations. Consists of a parameter info and an optional default type.
GenericFor
A struct representing a for-in loop.
GlobalFunction
A struct representing a local function.
IfExpression
A struct representing an elseif expression, only exists in variable declarations.
IfStatement
A struct representing an if statement
List
A list holding list items of type T.
LocalAssignment
A struct holding data for local assignments.
LocalFunction
A struct representing a local function.
Name
A variable name.
NumericalFor
A struct representing a numerical for loop.
Parameter
Parameter that a function can have. The difference between this and Name is the fact that Parameter.name can match variadic values (...) while Name can’t.
Range
A struct representing the range of any item.
RepeatBlock
A struct representing a repeat block.
SetExpression
A struct representing a set expression.
Table
Struct representing a luau table.
TableAccess
Represents an access to a table index.
TableField
A struct representing one table field. It’ll always have a key and a value that’s either a type or an expression. See table field values.
TypeDefinition
A struct for a type definition. Holds needed data to be able to write it back as valid luau.
WhileLoop
A struct representing a while loop.

Enums§

AstStatus
An enum representing different states of a CST.
ConversionError
Possible errors converting from an expression to a type definition.
Expression
An enum representing all possible values for an expression.
FunctionArgument
Arguments that can be passed in a FunctionCall.
FunctionArguments
All possible arguments that can be passed to a function.
FunctionCallInvoked
Different ways a function can be called.
GenericParameterInfo
A generic declaration parameter used in generics declarations. Can either be a name or a variadic pack.
GenericParameterInfoDefault
Struct holding default values for generic arguments.
GetRangeError
Errors that may occur during get_range. They should never happen if Cst.status is AstStatus::Complete.
GlobalFunctionName
An enum representing possible ways in which a global function’s name can be.
ListItem
A possible list item of type T.
ParameterTypeName
Parameters of a TypeValue::Function.
ParseNumberError
An enum representing errors that can occur during [Number::parse] stopping it from parsing the number, they should only be out-of-range errors and thus should be displayed for the user asking them to change the number.
ParsedNumber
An enum representing the return type of [Number::parse]..
PrefixExp
Part of expressions that are usually at the start of actual expressions.
PrintingError
An enum representing printing errors that stopped Cst::try_print from working.
Statement
All possible statements in a CST, excluding ending ones.
TableAccessKey
Enum representing different ways in which a table’s index can be accessed.
TableAccessPrefix
An enum representing different ways in which a table value can be returned from.
TableFieldValue
A possible value for a table field.
TableKey
A possible key entry in a table. The key is usually a string, but it can be a value (from an expression) in tables or a type in type definitions.
TerminationStatement
An enum representing different types of statements that can end a block of code. These statements may or may not be present.
TypeValue
Possible values for a type.
Var
Possible ways in which a variable can be referenced.

Traits§

GetRange
A trait for getting the range for this specific item.
Parse
A trait that to parse this struct from a lexer and starting with a specific token.
ParseWithArgs
A trait that to parse this struct from a lexer and starting with a specific token and with specific arguments.
Print
A trait to print the token as-is, while preserving all user spaces and styling.

Type Aliases§

BracketedList
A list holding list items of type T that must be surrounded by brackets.
ExpressionWrap
A struct representing an expression wrapped in parenthesis.
GenericDeclaration
The generics used in a type definition.
GenericParameters
Generics parameters used when referencing another type.
Pointer
The main pointer used in the Cst. It’s just Rc. The only reason this type exists is to allow easily switching to others, like Box or Arc by only editing one line instead of mass refactoring.