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 - Formatting settings for the GLSL transpiler
- Formatting
State - Formatting state of the GLSL transpiler
Enums§
- Indent
Style - Indentation style of the output
- Whitespace
- Formatter whitespace
Statics§
Traits§
- HasPrecedence 🔒
- Precedence information for transpiling parentheses properly
Functions§
- show_
array_ spec - Transpile an array_spec to GLSL
- show_
arrayed_ identifier - Transpile an arrayed_identifier to GLSL
- show_
assignment_ op - Transpile an assignment_op to GLSL
- show_
binary_ op - Transpile a binary_op to GLSL
- show_
block - Transpile a block
(f: &mut F, b: &ast::Block, state: &mut FormattingState to GLSL - show_
case_ label - Transpile a case_label to GLSL
- show_
compound_ statement - Transpile a compound_statement to GLSL
- show_
condition - Transpile a condition to GLSL
- show_
declaration - Transpile a declaration to GLSL
- show_
double - Transpile a double
(f: &mut F, x: f64, _: &mut FormattingState to GLSL - show_
expr - Transpile an expr to GLSL
- show_
expression_ statement - Transpile an expression_statement to GLSL
- show_
external_ declaration - Transpile an external_declaration to GLSL
- show_
float - Transpile a float
(f: &mut F, x: f32, _: &mut FormattingState to GLSL - show_
for_ init_ statement - Transpile a for_init_statement to GLSL
- show_
for_ rest_ statement - Transpile a for_rest_statement to GLSL
- show_
fully_ specified_ type - Transpile a fully_specified_type to GLSL
- show_
function_ definition - Transpile a function_definition to GLSL
- show_
function_ identifier - Transpile a function_identifier to GLSL
- show_
function_ parameter_ declaration - Transpile a function_parameter_declaration to GLSL
- show_
function_ parameter_ declarator - Transpile a function_parameter_declarator to GLSL
- show_
function_ prototype - Transpile a function_prototype to GLSL
- show_
identifier - Transpile an identifier to GLSL
- show_
init_ declarator_ list - Transpile an init_declarator_list to GLSL
- show_
initializer - Transpile an initializer to GLSL
- show_
interpolation_ qualifier - Transpile an interpolation_qualifier to GLSL
- show_
iteration_ statement - Transpile an iteration_statement to GLSL
- show_
jump_ statement - Transpile a jump_statement to GLSL
- show_
layout_ qualifier - Transpile a layout_qualifier to GLSL
- show_
layout_ qualifier_ spec - Transpile a layout_qualifier_spec to GLSL
- show_
path - Transpile a path
(f: &mut F, path: &ast::Path, _: &mut FormattingState to GLSL - show_
precision_ qualifier - Transpile a precision_qualifier to GLSL
- show_
preprocessor - Transpile a preprocessor to GLSL
- show_
preprocessor_ define - Transpile a preprocessor_define to GLSL
- show_
preprocessor_ else - Transpile a preprocessor_else
(f: &mut F, _: &mut FormattingState to GLSL - show_
preprocessor_ elseif - Transpile a preprocessor_elseif to GLSL
- show_
preprocessor_ endif - Transpile a preprocessor_endif
(f: &mut F, _: &mut FormattingState to GLSL - show_
preprocessor_ error - Transpile a preprocessor_error to GLSL
- show_
preprocessor_ extension - Transpile a preprocessor_extension to GLSL
- show_
preprocessor_ if - Transpile a preprocessor_if to GLSL
- show_
preprocessor_ ifdef - Transpile a preprocessor_ifdef to GLSL
- show_
preprocessor_ ifndef - Transpile a preprocessor_ifndef to GLSL
- show_
preprocessor_ include - Transpile a preprocessor_include to GLSL
- show_
preprocessor_ line - Transpile a preprocessor_line to GLSL
- show_
preprocessor_ pragma - Transpile a preprocessor_pragma to GLSL
- show_
preprocessor_ undef - Transpile a preprocessor_undef to GLSL
- show_
preprocessor_ version - Transpile a preprocessor_version to GLSL
- show_
selection_ rest_ statement - Transpile a selection_rest_statement to GLSL
- show_
selection_ statement - Transpile a selection_statement to GLSL
- show_
single_ declaration - Transpile a single_declaration to GLSL
- show_
single_ declaration_ no_ type - Transpile a single_declaration_no_type to GLSL
- show_
statement - Transpile a statement to GLSL
- show_
storage_ qualifier - Transpile a storage_qualifier to GLSL
- show_
struct - Transpile a struct to GLSL
- show_
struct_ field - Transpile a struct_field to GLSL
- show_
struct_ non_ declaration - Transpile a struct_non_declaration to GLSL
- show_
subroutine - Transpile a subroutine to GLSL
- show_
switch_ statement - Transpile a switch_statement to GLSL
- show_
translation_ unit - Transpile a translation_unit to GLSL
- show_
type_ name - Transpile a type_name to GLSL
- show_
type_ qualifier - Transpile a type_qualifier to GLSL
- show_
type_ qualifier_ spec - Transpile a type_qualifier_spec to GLSL
- show_
type_ specifier - Transpile a type_specifier to GLSL
- show_
type_ specifier_ non_ array - Transpile a type_specifier_non_array to GLSL
- show_
unary_ op - Transpile an unary_op to GLSL