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 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
ArrayedIdentifier | 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. |
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. |
Identifier | A generic identifier. |
InitDeclaratorList | Init declarator list. |
LayoutQualifier | Layout qualifier. |
NonEmpty | A non-empty |
PreprocessorElseIf | An #else preprocessor directive. |
PreprocessorError | An #error preprocessor directive. |
PreprocessorExtension | An #extension preprocessor directive. |
PreprocessorIf | An #if preprocessor directive. |
PreprocessorIfDef | An #ifdef preprocessor directive. |
PreprocessorIfNDef | A #ifndef preprocessor directive. |
PreprocessorInclude | An #include name annotation. |
PreprocessorLine | A #line preprocessor directive. |
PreprocessorPragma | A #pragma preprocessor directive. Holds compiler-specific command. |
PreprocessorUndef | A #undef preprocessor directive. |
PreprocessorVersion | A #version preprocessor directive. |
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. |
TranslationUnit | Starting rule. |
TypeName | Any type name. |
TypeQualifier | Type qualifier. |
TypeSpecifier | Type specifier. |
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. |
IdentifierError | Error that might occur when creating a new |
Initializer | Initializer. |
InterpolationQualifier | Interpolation qualifier. |
IterationStatement | Iteration statement. |
JumpStatement | Jump statement. |
LayoutQualifierSpec | Layout qualifier spec. |
Path | A path literal. |
PrecisionQualifier | Precision qualifier. |
Preprocessor | Some basic preprocessor directives. |
PreprocessorDefine | A #define preprocessor directive. |
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. |
TypeSpecifierNonArray | Type specifier (non-array). |
UnaryOp | All unary operators that exist in GLSL. |
Type Definitions
ExprStatement | Expression statement. |
ShaderStage | A shader stage. |