Module ast

Source
Expand description

GLSL abstract syntax tree and grammar.

This module exports all the grammar syntax that defines GLSL. You’ll be handling ASTs representing your GLSL source.

The most external form of a GLSL parsed AST is TranslationUnit (a shader). Some parts of the tree are boxed. This is due to two facts:

  • Recursion is used, hence we need a way to give our types a static size.
  • Because of some very deep variants, runtime size would explode if no indirection weren’t in place.

The types are commented so feel free to inspect each of theme. As a starter, you should read the documentation of Expr, FunctionDefinition, Statement and TranslationUnit.

Structs§

ArraySpecifierData
Dimensionality of an array.
ArrayedIdentifierData
An identifier with an optional array specifier.
BlockData
A general purpose block, containing fields and possibly a list of declared identifiers. Semantic is given with the storage qualifier.
CompoundStatementData
Compound statement (with no new scope).
ExprStatementData
Expression statement.
FileId
Unique file identifier
ForRestStatementData
For init statement.
FullySpecifiedTypeData
Fully specified type.
FunctionDefinitionData
Function definition.
FunctionParameterDeclaratorData
Function parameter declarator.
FunctionPrototypeData
Function prototype.
IdentifierData
A generic identifier.
InitDeclaratorListData
Init declarator list.
LayoutQualifierData
Layout qualifier.
Node
A syntax node with span information
NodeSpan
Span information for a node, constructed from a pair of LexerPositions
PreprocessorElseIfData
An #else preprocessor directive.
PreprocessorErrorData
An #error preprocessor directive.
PreprocessorExtensionData
An #extension preprocessor directive.
PreprocessorIfData
An #if preprocessor directive.
PreprocessorIfDefData
An #ifdef preprocessor directive.
PreprocessorIfNDefData
A #ifndef preprocessor directive.
PreprocessorIncludeData
An #include name annotation.
PreprocessorLineData
A #line preprocessor directive.
PreprocessorPragmaData
A #pragma preprocessor directive. Holds compiler-specific command.
PreprocessorUndefData
A #undef preprocessor directive.
PreprocessorVersionData
A #version preprocessor directive.
SelectionStatementData
Selection statement.
SingleDeclarationData
Single declaration.
SingleDeclarationNoTypeData
A single declaration with implicit, already-defined type.
SmolStr
A SmolStr is a string type that has the following properties:
StructFieldSpecifierData
Struct field specifier. Used to add fields to struct specifiers.
StructSpecifierData
Struct specifier. Used to create new, user-defined types.
SwitchStatementData
Switch statement.
TextRange
A range in text, represented as a pair of TextSize.
TextSize
A measure of text length. Also, equivalently, an index into text.
TranslationUnit
Starting rule.
TypeNameData
Any type name.
TypeQualifierData
Type qualifier.
TypeSpecifierData
Type specifier.

Enums§

ArraySpecifierDimensionData
One array specifier dimension.
AssignmentOpData
All possible operators for assigning expressions.
BinaryOpData
All binary operators that exist in GLSL.
CaseLabelData
Case label statement.
CommentData
A comment
ConditionData
Condition.
DeclarationData
A declaration.
ExprData
The most general form of an expression.
ExternalDeclarationData
External declaration.
ForInitStatementData
For init statement.
FunIdentifierData
Function identifier.
FunctionParameterDeclarationData
Function parameter declaration.
InitializerData
Initializer.
InterpolationQualifierData
Interpolation qualifier.
IterationStatementData
Iteration statement.
JumpStatementData
Jump statement.
LayoutQualifierSpecData
Layout qualifier spec.
PathData
A path literal.
PrecisionQualifierData
Precision qualifier.
PreprocessorData
Some basic preprocessor directives.
PreprocessorDefineData
A #define preprocessor directive.
PreprocessorExtensionBehaviorData
An #extension behavior annotation.
PreprocessorExtensionNameData
An #extension name annotation.
PreprocessorVersionProfileData
A #version profile annotation.
SelectionRestStatementData
Selection rest statement.
StatementData
Statement.
StorageQualifierData
Storage qualifier.
TypeQualifierSpecData
Type qualifier spec.
TypeSpecifierNonArrayData
Type specifier (non-array).
UnaryOpData
All unary operators that exist in GLSL.

Traits§

NodeContent
Trait for AST node contents.
NodeDisplay
Trait for displaying a syntax node

Type Aliases§

ArraySpecifier
Type alias for Node<ArraySpecifierData>.
ArraySpecifierDimension
Type alias for Node<ArraySpecifierDimensionData>.
ArrayedIdentifier
Type alias for Node<ArrayedIdentifierData>.
AssignmentOp
Type alias for Node<AssignmentOpData>.
BinaryOp
Type alias for Node<BinaryOpData>.
Block
Type alias for Node<BlockData>.
CaseLabel
Type alias for Node<CaseLabelData>.
Comment
Type alias for Node<CommentData>.
CompoundStatement
Type alias for Node<CompoundStatementData>.
Condition
Type alias for Node<ConditionData>.
Declaration
Type alias for Node<DeclarationData>.
Expr
Type alias for Node<ExprData>.
ExprStatement
Type alias for Node<ExprStatementData>.
ExternalDeclaration
Type alias for Node<ExternalDeclarationData>.
ForInitStatement
Type alias for Node<ForInitStatementData>.
ForRestStatement
Type alias for Node<ForRestStatementData>.
FullySpecifiedType
Type alias for Node<FullySpecifiedTypeData>.
FunIdentifier
Type alias for Node<FunIdentifierData>.
FunctionDefinition
Type alias for Node<FunctionDefinitionData>.
FunctionParameterDeclaration
Type alias for Node<FunctionParameterDeclarationData>.
FunctionParameterDeclarator
Type alias for Node<FunctionParameterDeclaratorData>.
FunctionPrototype
Type alias for Node<FunctionPrototypeData>.
Identifier
Type alias for Node<IdentifierData>.
InitDeclaratorList
Type alias for Node<InitDeclaratorListData>.
Initializer
Type alias for Node<InitializerData>.
InterpolationQualifier
Type alias for Node<InterpolationQualifierData>.
IterationStatement
Type alias for Node<IterationStatementData>.
JumpStatement
Type alias for Node<JumpStatementData>.
LayoutQualifier
Type alias for Node<LayoutQualifierData>.
LayoutQualifierSpec
Type alias for Node<LayoutQualifierSpecData>.
Path
Type alias for Node<PathData>.
PrecisionQualifier
Type alias for Node<PrecisionQualifierData>.
Preprocessor
Type alias for Node<PreprocessorData>.
PreprocessorDefine
Type alias for Node<PreprocessorDefineData>.
PreprocessorElseIf
Type alias for Node<PreprocessorElseIfData>.
PreprocessorError
Type alias for Node<PreprocessorErrorData>.
PreprocessorExtension
Type alias for Node<PreprocessorExtensionData>.
PreprocessorExtensionBehavior
Type alias for Node<PreprocessorExtensionBehaviorData>.
PreprocessorExtensionName
Type alias for Node<PreprocessorExtensionNameData>.
PreprocessorIf
Type alias for Node<PreprocessorIfData>.
PreprocessorIfDef
Type alias for Node<PreprocessorIfDefData>.
PreprocessorIfNDef
Type alias for Node<PreprocessorIfNDefData>.
PreprocessorInclude
Type alias for Node<PreprocessorIncludeData>.
PreprocessorLine
Type alias for Node<PreprocessorLineData>.
PreprocessorPragma
Type alias for Node<PreprocessorPragmaData>.
PreprocessorUndef
Type alias for Node<PreprocessorUndefData>.
PreprocessorVersion
Type alias for Node<PreprocessorVersionData>.
PreprocessorVersionProfile
Type alias for Node<PreprocessorVersionProfileData>.
SelectionRestStatement
Type alias for Node<SelectionRestStatementData>.
SelectionStatement
Type alias for Node<SelectionStatementData>.
SingleDeclaration
Type alias for Node<SingleDeclarationData>.
SingleDeclarationNoType
Type alias for Node<SingleDeclarationNoTypeData>.
Statement
Type alias for Node<StatementData>.
StorageQualifier
Type alias for Node<StorageQualifierData>.
StructFieldSpecifier
Type alias for Node<StructFieldSpecifierData>.
StructSpecifier
Type alias for Node<StructSpecifierData>.
SwitchStatement
Type alias for Node<SwitchStatementData>.
TypeName
Type alias for Node<TypeNameData>.
TypeQualifier
Type alias for Node<TypeQualifierData>.
TypeQualifierSpec
Type alias for Node<TypeQualifierSpecData>.
TypeSpecifier
Type alias for Node<TypeSpecifierData>.
TypeSpecifierNonArray
Type alias for Node<TypeSpecifierNonArrayData>.
UnaryOp
Type alias for Node<UnaryOpData>.

Derive Macros§

NodeContentDisplay
Derives an implementation of NodeContentDisplay for the given type.