Module glsl_lang::transpiler::glsl
source · Expand description
A GLSL450/GLSL460 transpiler that takes a syntax tree and writes it as a plain raw GLSL
String
.
§Foreword
This module exports several functions that just transform a part of a syntax tree into its raw
GLSL String
representation.
Important note: this module – and actually, any
transpiler
module – is not responsible in optimizing the syntax tree nor semantically check its validity. This is done in other stages of the compilation process.
In order to achieve that purpose, you could:
- For each elements in the AST, return a
String
orCow<str>
. - Insert the string representation via a formatter.
The second solution is better because it lets the user handle the memory the way they want:
they might just use a dynamic buffer that implements Write
or simply pass a &mut
String
. It’s up to you.
§How to use this module
First, head over to the ast
module. That module defines the AST items defined by GLSL. This
very module provides you with functions like show_*
taking the AST item and writing it to a
Write
object. You’re likely to be interested in show_translation_unit
to start with.
Structs§
- Formatting settings for the GLSL transpiler
- Formatting state of the GLSL transpiler
Enums§
- Indentation style of the output
- Formatter whitespace
Statics§
Traits§
- Precedence information for transpiling parentheses properly
Functions§
- Transpile an array_spec to GLSL
- Transpile an arrayed_identifier to GLSL
- Transpile an assignment_op to GLSL
- Transpile a binary_op to GLSL
- Transpile a block
(f: &mut F, b: &ast::Block, state: &mut FormattingState to GLSL - Transpile a case_label to GLSL
- Transpile a compound_statement to GLSL
- Transpile a condition to GLSL
- Transpile a declaration to GLSL
- Transpile a double
(f: &mut F, x: f64, _: &mut FormattingState to GLSL - Transpile an expr to GLSL
- Transpile an expression_statement to GLSL
- Transpile an external_declaration to GLSL
- Transpile a float
(f: &mut F, x: f32, _: &mut FormattingState to GLSL - Transpile a for_init_statement to GLSL
- Transpile a for_rest_statement to GLSL
- Transpile a fully_specified_type to GLSL
- Transpile a function_definition to GLSL
- Transpile a function_identifier to GLSL
- Transpile a function_parameter_declaration to GLSL
- Transpile a function_parameter_declarator to GLSL
- Transpile a function_prototype to GLSL
- Transpile an identifier to GLSL
- Transpile an init_declarator_list to GLSL
- Transpile an initializer to GLSL
- Transpile an interpolation_qualifier to GLSL
- Transpile an iteration_statement to GLSL
- Transpile a jump_statement to GLSL
- Transpile a layout_qualifier to GLSL
- Transpile a layout_qualifier_spec to GLSL
- Transpile a path
(f: &mut F, path: &ast::Path, _: &mut FormattingState to GLSL - Transpile a precision_qualifier to GLSL
- Transpile a preprocessor to GLSL
- Transpile a preprocessor_define to GLSL
- Transpile a preprocessor_else
(f: &mut F, _: &mut FormattingState to GLSL - Transpile a preprocessor_elseif to GLSL
- Transpile a preprocessor_endif
(f: &mut F, _: &mut FormattingState to GLSL - Transpile a preprocessor_error to GLSL
- Transpile a preprocessor_extension to GLSL
- Transpile a preprocessor_if to GLSL
- Transpile a preprocessor_ifdef to GLSL
- Transpile a preprocessor_ifndef to GLSL
- Transpile a preprocessor_include to GLSL
- Transpile a preprocessor_line to GLSL
- Transpile a preprocessor_pragma to GLSL
- Transpile a preprocessor_undef to GLSL
- Transpile a preprocessor_version to GLSL
- Transpile a selection_rest_statement to GLSL
- Transpile a selection_statement to GLSL
- Transpile a single_declaration to GLSL
- Transpile a single_declaration_no_type to GLSL
- Transpile a statement to GLSL
- Transpile a storage_qualifier to GLSL
- Transpile a struct to GLSL
- Transpile a struct_field to GLSL
- Transpile a struct_non_declaration to GLSL
- Transpile a subroutine to GLSL
- Transpile a switch_statement to GLSL
- Transpile a translation_unit to GLSL
- Transpile a type_name to GLSL
- Transpile a type_qualifier to GLSL
- Transpile a type_qualifier_spec to GLSL
- Transpile a type_specifier to GLSL
- Transpile a type_specifier_non_array to GLSL
- Transpile an unary_op to GLSL