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 - Dimensionality of an array.
- Arrayed
Identifier - An identifier with an optional array specifier.
- Block
- A general purpose block, containing fields and possibly a list of declared identifiers. Semantic is given with the storage qualifier.
- Compound
Statement - Compound statement (with no new scope).
- ForRest
Statement - For init statement.
- Fully
Specified Type - Fully specified type.
- Function
Definition - Function definition.
- Function
Parameter Declarator - Function parameter declarator.
- Function
Prototype - Function prototype.
- Identifier
- A generic identifier.
- Init
Declarator List - Init declarator list.
- Layout
Qualifier - Layout qualifier.
- NonEmpty
- A non-empty
Vec. It has at least one element. - Preprocessor
ElIf - An #elif preprocessor directive.
- Preprocessor
Error - An #error preprocessor directive.
- Preprocessor
Extension - An #extension preprocessor directive.
- Preprocessor
If - An #if preprocessor directive.
- Preprocessor
IfDef - An #ifdef preprocessor directive.
- Preprocessor
IfNDef - A #ifndef preprocessor directive.
- Preprocessor
Include - An #include name annotation.
- Preprocessor
Line - A #line preprocessor directive.
- Preprocessor
Pragma - A #pragma preprocessor directive. Holds compiler-specific command.
- Preprocessor
Undef - A #undef preprocessor directive.
- Preprocessor
Version - A #version preprocessor directive.
- Selection
Statement - Selection statement.
- Single
Declaration - Single declaration.
- Single
Declaration NoType - A single declaration with implicit, already-defined type.
- Struct
Field Specifier - Struct field specifier. Used to add fields to struct specifiers.
- Struct
Specifier - Struct specifier. Used to create new, user-defined types.
- Switch
Statement - Switch statement.
- Translation
Unit - Starting rule.
- Type
Name - Any type name.
- Type
Qualifier - Type qualifier.
- Type
Specifier - Type specifier.
Enums§
- Array
Specifier Dimension - One array specifier dimension.
- Assignment
Op - All possible operators for assigning expressions.
- Binary
Op - All binary operators that exist in GLSL.
- Case
Label - Case label statement.
- Condition
- Condition.
- Declaration
- A declaration.
- Expr
- The most general form of an expression. As you can see if you read the variant list, in GLSL, an assignment is an expression. This is a bit silly but think of an assignment as a statement first then an expression which evaluates to what the statement “returns”.
- External
Declaration - External declaration.
- ForInit
Statement - For init statement.
- FunIdentifier
- Function identifier.
- Function
Parameter Declaration - Function parameter declaration.
- Identifier
Error - Error that might occur when creating a new
Identifier. - Initializer
- Initializer.
- Interpolation
Qualifier - Interpolation qualifier.
- Iteration
Statement - Iteration statement.
- Jump
Statement - Jump statement.
- Layout
Qualifier Spec - Layout qualifier spec.
- Path
- A path literal.
- Precision
Qualifier - Precision qualifier.
- Preprocessor
- Some basic preprocessor directives.
- Preprocessor
Define - A #define preprocessor directive.
- Preprocessor
Extension Behavior - An #extension behavior annotation.
- Preprocessor
Extension Name - An #extension name annotation.
- Preprocessor
Version Profile - A #version profile annotation.
- Selection
Rest Statement - Selection rest statement.
- Simple
Statement - Simple statement.
- Statement
- Statement.
- Storage
Qualifier - Storage qualifier.
- Type
Qualifier Spec - Type qualifier spec.
- Type
Specifier NonArray - Type specifier (non-array).
- UnaryOp
- All unary operators that exist in GLSL.
Type Aliases§
- Expr
Statement - Expression statement.
- Shader
Stage - A shader stage.