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.
- Compound
SetExpression - 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
- Else
IfExpression - A struct representing an elseif expression, only exists in expressions.
- Else
IfStatement - A struct representing an
elseifstatement - Else
Statement - A struct representing an
elsestatement - EndOf
File - The
EndOfFiletoken. This token is always the last token in a file. It’ll only really be useful if a file has no code but only comments - the comments will be stored intoken.leading_triviaand there’s no other way to detect such comments. - Function
Call - A struct representing a function call.
- Generic
Declaration Parameter - A generic declaration parameter used in
generic declarations. Consists of aparameter infoand an optional default type. - Generic
For - A struct representing a for-in loop.
- Global
Function - A struct representing a local function.
- IfExpression
- A struct representing an elseif expression, only exists in variable declarations.
- IfStatement
- A struct representing an
ifstatement - List
- A list holding
list itemsof typeT. - Local
Assignment - A struct holding data for local assignments.
- Local
Function - A struct representing a local function.
- Name
- A variable name.
- Numerical
For - A struct representing a numerical for loop.
- Parameter
- Parameter that a function can have. The difference between this and
Nameis the fact thatParameter.namecan match variadic values (...) whileNamecan’t. - Range
- A struct representing the range of any item.
- Repeat
Block - A struct representing a repeat block.
- SetExpression
- A struct representing a set expression.
- Table
- Struct representing a luau table.
- Table
Access - Represents an access to a table index.
- Table
Field - A struct representing one table field. It’ll always have a
keyand a value that’s either atypeor anexpression. Seetable field values. - Type
Definition - A struct for a type definition. Holds needed data to be able to write it back as valid luau.
- Type
Function - Type functions (LuauSolver V2).
- While
Loop - A struct representing a while loop.
Enums§
- AstStatus
- An enum representing different states of a CST.
- Conversion
Error - Possible errors converting from an expression to a type definition.
- Expression
- An enum representing all possible values for an expression.
- Function
Argument - Arguments that can be passed in a
FunctionCall. - Function
Arguments - All possible arguments that can be passed to a function.
- Function
Call Invoked - Different ways a function can be called.
- Generic
Parameter Info - A generic declaration parameter used in
generics declarations. Can either be a name or a variadic pack. - Generic
Parameter Info Default - Struct holding default values for generic arguments.
- GetRange
Error - Errors that may occur during
get_range. They should never happen ifCst.statusisAstStatus::Complete. - Global
Function Name - An enum representing possible ways in which a global function’s name can be.
- List
Item - A possible list item of type
T. - Parameter
Type Name - Parameters of a
TypeValue::Function. - Parse
Number Error - 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. - Parsed
Number - An enum representing the return type of [
Number::parse].. - Prefix
Exp - Part of expressions that are usually at the start of actual expressions.
- Printing
Error - An enum representing printing errors that stopped
Cst::try_printfrom working. - Statement
- All possible statements in a
CST, excluding ending ones. - Table
Access Key - Enum representing different ways in which a table’s index can be accessed.
- Table
Access Prefix - An enum representing different ways in which a table value can be returned from.
- Table
Field Value - A possible value for a
table field. - Table
Key - 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.
- Termination
Statement - An enum representing different types of statements that can end a block of code. These statements may or may not be present.
- Type
Value - 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
lexerand starting with a specifictoken. - Parse
With Args - A trait that to parse this struct from a
lexerand starting with a specifictokenand with specific arguments. - A trait to print the token as-is, while preserving all user spaces, comments and styling.
Type Aliases§
- Bracketed
List - A
listholdinglist itemsof typeTthat must be surrounded bybrackets. - Expression
Wrap - A struct representing an expression wrapped in parenthesis.
- Generic
Declaration - The generics used in a
type definition. - Generic
Parameters - Generics parameters used when referencing another type.
- Pointer
- The main pointer used in the
Cst. It’s justRc. The only reason this type exists is to allow easily switching to others, likeBoxorArcby only editing one line instead of mass refactoring.