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§
- Array
Specifier Data - Dimensionality of an array.
- Arrayed
Identifier Data - An identifier with an optional array specifier.
- Block
Data - A general purpose block, containing fields and possibly a list of declared identifiers. Semantic is given with the storage qualifier.
- Compound
Statement Data - Compound statement (with no new scope).
- Expr
Statement Data - Expression statement.
- FileId
- Unique file identifier
- ForRest
Statement Data - For init statement.
- Fully
Specified Type Data - Fully specified type.
- Function
Definition Data - Function definition.
- Function
Parameter Declarator Data - Function parameter declarator.
- Function
Prototype Data - Function prototype.
- Identifier
Data - A generic identifier.
- Init
Declarator List Data - Init declarator list.
- Layout
Qualifier Data - Layout qualifier.
- Node
- A syntax node with span information
- Node
Span - Span information for a node, constructed from a pair of LexerPositions
- Preprocessor
Else IfData - An #else preprocessor directive.
- Preprocessor
Error Data - An #error preprocessor directive.
- Preprocessor
Extension Data - An #extension preprocessor directive.
- Preprocessor
IfData - An #if preprocessor directive.
- Preprocessor
IfDef Data - An #ifdef preprocessor directive.
- Preprocessor
IfNDef Data - A #ifndef preprocessor directive.
- Preprocessor
Include Data - An #include name annotation.
- Preprocessor
Line Data - A #line preprocessor directive.
- Preprocessor
Pragma Data - A #pragma preprocessor directive. Holds compiler-specific command.
- Preprocessor
Undef Data - A #undef preprocessor directive.
- Preprocessor
Version Data - A #version preprocessor directive.
- Selection
Statement Data - Selection statement.
- Single
Declaration Data - Single declaration.
- Single
Declaration NoType Data - A single declaration with implicit, already-defined type.
- SmolStr
- A
SmolStr
is a string type that has the following properties: - Struct
Field Specifier Data - Struct field specifier. Used to add fields to struct specifiers.
- Struct
Specifier Data - Struct specifier. Used to create new, user-defined types.
- Switch
Statement Data - Switch statement.
- Text
Range - A range in text, represented as a pair of
TextSize
. - Text
Size - A measure of text length. Also, equivalently, an index into text.
- Translation
Unit - Starting rule.
- Type
Name Data - Any type name.
- Type
Qualifier Data - Type qualifier.
- Type
Specifier Data - Type specifier.
Enums§
- Array
Specifier Dimension Data - One array specifier dimension.
- Assignment
OpData - All possible operators for assigning expressions.
- Binary
OpData - All binary operators that exist in GLSL.
- Case
Label Data - Case label statement.
- Comment
Data - A comment
- Condition
Data - Condition.
- Declaration
Data - A declaration.
- Expr
Data - The most general form of an expression.
- External
Declaration Data - External declaration.
- ForInit
Statement Data - For init statement.
- FunIdentifier
Data - Function identifier.
- Function
Parameter Declaration Data - Function parameter declaration.
- Initializer
Data - Initializer.
- Interpolation
Qualifier Data - Interpolation qualifier.
- Iteration
Statement Data - Iteration statement.
- Jump
Statement Data - Jump statement.
- Layout
Qualifier Spec Data - Layout qualifier spec.
- Path
Data - A path literal.
- Precision
Qualifier Data - Precision qualifier.
- Preprocessor
Data - Some basic preprocessor directives.
- Preprocessor
Define Data - A #define preprocessor directive.
- Preprocessor
Extension Behavior Data - An #extension behavior annotation.
- Preprocessor
Extension Name Data - An #extension name annotation.
- Preprocessor
Version Profile Data - A #version profile annotation.
- Selection
Rest Statement Data - Selection rest statement.
- Statement
Data - Statement.
- Storage
Qualifier Data - Storage qualifier.
- Type
Qualifier Spec Data - Type qualifier spec.
- Type
Specifier NonArray Data - Type specifier (non-array).
- Unary
OpData - All unary operators that exist in GLSL.
Traits§
- Node
Content - Trait for AST node contents.
- Node
Display - Trait for displaying a syntax node
Type Aliases§
- Array
Specifier - Type alias for
Node<ArraySpecifierData>
. - Array
Specifier Dimension - Type alias for
Node<ArraySpecifierDimensionData>
. - Arrayed
Identifier - Type alias for
Node<ArrayedIdentifierData>
. - Assignment
Op - Type alias for
Node<AssignmentOpData>
. - Binary
Op - Type alias for
Node<BinaryOpData>
. - Block
- Type alias for
Node<BlockData>
. - Case
Label - Type alias for
Node<CaseLabelData>
. - Comment
- Type alias for
Node<CommentData>
. - Compound
Statement - Type alias for
Node<CompoundStatementData>
. - Condition
- Type alias for
Node<ConditionData>
. - Declaration
- Type alias for
Node<DeclarationData>
. - Expr
- Type alias for
Node<ExprData>
. - Expr
Statement - Type alias for
Node<ExprStatementData>
. - External
Declaration - Type alias for
Node<ExternalDeclarationData>
. - ForInit
Statement - Type alias for
Node<ForInitStatementData>
. - ForRest
Statement - Type alias for
Node<ForRestStatementData>
. - Fully
Specified Type - Type alias for
Node<FullySpecifiedTypeData>
. - FunIdentifier
- Type alias for
Node<FunIdentifierData>
. - Function
Definition - Type alias for
Node<FunctionDefinitionData>
. - Function
Parameter Declaration - Type alias for
Node<FunctionParameterDeclarationData>
. - Function
Parameter Declarator - Type alias for
Node<FunctionParameterDeclaratorData>
. - Function
Prototype - Type alias for
Node<FunctionPrototypeData>
. - Identifier
- Type alias for
Node<IdentifierData>
. - Init
Declarator List - Type alias for
Node<InitDeclaratorListData>
. - Initializer
- Type alias for
Node<InitializerData>
. - Interpolation
Qualifier - Type alias for
Node<InterpolationQualifierData>
. - Iteration
Statement - Type alias for
Node<IterationStatementData>
. - Jump
Statement - Type alias for
Node<JumpStatementData>
. - Layout
Qualifier - Type alias for
Node<LayoutQualifierData>
. - Layout
Qualifier Spec - Type alias for
Node<LayoutQualifierSpecData>
. - Path
- Type alias for
Node<PathData>
. - Precision
Qualifier - Type alias for
Node<PrecisionQualifierData>
. - Preprocessor
- Type alias for
Node<PreprocessorData>
. - Preprocessor
Define - Type alias for
Node<PreprocessorDefineData>
. - Preprocessor
Else If - Type alias for
Node<PreprocessorElseIfData>
. - Preprocessor
Error - Type alias for
Node<PreprocessorErrorData>
. - Preprocessor
Extension - Type alias for
Node<PreprocessorExtensionData>
. - Preprocessor
Extension Behavior - Type alias for
Node<PreprocessorExtensionBehaviorData>
. - Preprocessor
Extension Name - Type alias for
Node<PreprocessorExtensionNameData>
. - Preprocessor
If - Type alias for
Node<PreprocessorIfData>
. - Preprocessor
IfDef - Type alias for
Node<PreprocessorIfDefData>
. - Preprocessor
IfNDef - Type alias for
Node<PreprocessorIfNDefData>
. - Preprocessor
Include - Type alias for
Node<PreprocessorIncludeData>
. - Preprocessor
Line - Type alias for
Node<PreprocessorLineData>
. - Preprocessor
Pragma - Type alias for
Node<PreprocessorPragmaData>
. - Preprocessor
Undef - Type alias for
Node<PreprocessorUndefData>
. - Preprocessor
Version - Type alias for
Node<PreprocessorVersionData>
. - Preprocessor
Version Profile - Type alias for
Node<PreprocessorVersionProfileData>
. - Selection
Rest Statement - Type alias for
Node<SelectionRestStatementData>
. - Selection
Statement - Type alias for
Node<SelectionStatementData>
. - Single
Declaration - Type alias for
Node<SingleDeclarationData>
. - Single
Declaration NoType - Type alias for
Node<SingleDeclarationNoTypeData>
. - Statement
- Type alias for
Node<StatementData>
. - Storage
Qualifier - Type alias for
Node<StorageQualifierData>
. - Struct
Field Specifier - Type alias for
Node<StructFieldSpecifierData>
. - Struct
Specifier - Type alias for
Node<StructSpecifierData>
. - Switch
Statement - Type alias for
Node<SwitchStatementData>
. - Type
Name - Type alias for
Node<TypeNameData>
. - Type
Qualifier - Type alias for
Node<TypeQualifierData>
. - Type
Qualifier Spec - Type alias for
Node<TypeQualifierSpecData>
. - Type
Specifier - Type alias for
Node<TypeSpecifierData>
. - Type
Specifier NonArray - Type alias for
Node<TypeSpecifierNonArrayData>
. - UnaryOp
- Type alias for
Node<UnaryOpData>
.
Derive Macros§
- Node
Content Display - Derives an implementation of
NodeContentDisplay
for the given type.