Module glsl::syntax
[−]
[src]
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 part of the
tree are boxed. This is due to the 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
Block |
A general purpose block, containing fields and possibly a list of declared identifiers. Semantic is given with the storage qualifier. |
CompoundStatement |
Compound statement (with no new scope). |
ForRestStatement |
For init statement. |
FullySpecifiedType |
Fully specified type. |
FunctionDefinition |
Function definition. |
FunctionParameterDeclarator |
Function parameter declarator. |
FunctionPrototype |
Function prototype. |
InitDeclaratorList |
Init declarator list. |
LayoutQualifier |
Layout qualifier. |
PreprocessorExtension |
An #extension preprocessor command. |
PreprocessorVersion |
A #version preprocessor command. |
SelectionStatement |
Selection statement. |
SingleDeclaration |
Single declaration. |
SingleDeclarationNoType |
A single declaration with implicit, already-defined type. |
StructFieldSpecifier |
Struct field specifier. Used to add fields to struct specifiers. |
StructSpecifier |
Struct specifier. Used to create new, user-defined types. |
SwitchStatement |
Switch statement. |
TypeQualifier |
Type qualifier. |
Enums
ArraySpecifier |
Dimensionality of an arary. |
AssignmentOp |
All possible operators for assigning expressions. |
BinaryOp |
All binary operators that exist in GLSL. |
CaseLabel |
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”. |
ExternalDeclaration |
External declaration. |
ForInitStatement |
For init statement. |
FunIdentifier |
Function identifier. |
FunctionParameterDeclaration |
Function parameter declaration. |
Initializer |
Initializer. |
InterpolationQualifier |
Interpolation qualifier. |
IterationStatement |
Iteration statement. |
JumpStatement |
Jump statement. |
LayoutQualifierSpec |
Layout qualifier spec. |
PrecisionQualifier |
Precision qualifier. |
Preprocessor |
Some basic preprocessor commands. |
PreprocessorExtensionBehavior |
An #extension behavior annotation. |
PreprocessorExtensionName |
An #extension name annotation. |
PreprocessorVersionProfile |
A #version profile annotation. |
SelectionRestStatement |
Selection rest statement. |
SimpleStatement |
Simple statement. |
Statement |
Statement. |
StorageQualifier |
Storage qualifier. |
TypeQualifierSpec |
Type qualifier spec. |
TypeSpecifier |
Type specifier. |
UnaryOp |
All unary operators that exist in GLSL. |
Type Definitions
ExprStatement |
Expression statement. |
Identifier |
A generic identifier. |
NonEmpty |
A non-empty |
TranslationUnit |
Starting rule. |
TypeName |
Any type name. |