|
Blender V5.3
|
#include "scope.hh"#include "token.hh"#include "token_stream.hh"#include "utils.hh"#include <algorithm>#include <cassert>#include <iostream>Go to the source code of this file.
Namespaces | |
| namespace | blender |
| BMesh Iterators. | |
| namespace | blender::gpu |
| namespace | blender::gpu::shader |
| namespace | blender::gpu::shader::parser |
Functions | |
| std::ostream & | blender::gpu::shader::parser::operator<< (std::ostream &out, const std::vector< int > &v) |
Very simple parsing of our shader file that are a subset of C++. It allows to traverse the semantic using tokens and scopes instead of trying to match string patterns throughout the whole input string.
The goal of this representation is to output code that doesn't modify the style of the input string and keep the same line numbers (to match compilation error with input source).
The TokenStream class contain a copy of the given string to apply string substitutions (called Mutation). It is usually faster to record all of them and apply them all at once after scanning through the whole semantic representation. In the rare case where mutation need to overlap (recursive processing), it is better to do them in passes until there is no mutation to do.
Token and Scope are read only interfaces to the data stored inside the TokenStream. The data is stored as SoA (Structure of Arrays) for fast traversal. The types of token and scopes are defined as readable chars to easily create sequences of token type.
The parsing phase doesn't apply any preprocessor. All preprocessor directive are parsed as Preprocessor scope but they are not expanded.
Definition in file intermediate.hh.