Blender V5.3
blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn > Struct Template Reference

#include <intermediate.hh>

Inherits blender::gpu::shader::parser::MutableString, and blender::gpu::shader::parser::Parser< LexerFn, ParserFn >.

Public Member Functions

 IntermediateForm (const std::string_view input, ErrorHandler &report_error)
 IntermediateForm (ErrorHandler &report_error)
void set_str (const std::string_view input)
Scope operator() () const
bool only_apply_mutations (const bool all_mutation_ordered=false)
bool apply_mutations (const bool all_mutation_ordered=false)
const std::string & result_get (const bool all_mutation_ordered=false)
void parse (ErrorHandler &report_error)
void debug_print ()
void debug_print_tokens ()
Public Member Functions inherited from blender::gpu::shader::parser::MutableString
 MutableString (const std::string_view input)
 MutableString (const MutableString &other)=delete
MutableString & operator= (const MutableString &other)=delete
 MutableString (MutableString &&other)=default
MutableString & operator= (MutableString &&other)=default
std::string substr_range_inclusive (size_t start, size_t end)
std::string substr_range_inclusive (Token start, Token end)
std::string_view substr_range_inclusive_view (size_t start, size_t end)
std::string_view substr_range_inclusive_view (Token start, Token end)
bool report_failure ()
bool replace_try (size_t from, size_t to, const std::string &replacement)
bool replace_try (Token from, Token to, const std::string &replacement, bool keep_trailing_whitespaces=false)
void replace (size_t from, size_t to, const std::string &replacement)
void replace (Token from, Token to, const std::string &replacement, bool keep_trailing_whitespaces=false)
void replace (Token tok, const std::string &replacement, bool keep_trailing_whitespaces=false)
void replace (Scope scope, const std::string &replacement, bool keep_trailing_whitespaces=false)
void replace (ast::Node node, const std::string &replacement, bool keep_trailing_whitespaces=false)
bool erase_try (size_t from, size_t to)
void erase (size_t from, size_t to)
bool erase_try (Token from, Token to)
void erase (Token from, Token to)
bool erase_try (Token tok)
void erase (Token tok)
bool erase_try (Scope scope)
void erase (Scope scope)
bool erase_try (ast::Node node)
void erase (ast::Node node)
void insert_before (size_t at, const std::string &content, bool prepend=false)
void insert_before (Token at, const std::string &content, bool prepend=false)
void insert_after (size_t at, const std::string &content)
void insert_after (Token at, const std::string &content)
void insert_line_number (size_t at, int line, std::string_view filename="")
void insert_line_number (Token at, int line, std::string_view filename="")
void insert_directive (Token at, const std::string directive)
bool apply_mutations (LexerBase &lexer, const bool all_mutation_ordered=false)
const std::string & str ()
std::string serialize_mutations () const
Public Member Functions inherited from blender::gpu::shader::parser::Parser< LexerFn, ParserFn >
void lexical_analysis (std::string_view input)
void semantic_analysis (ErrorHandler &err_handler)
Public Member Functions inherited from blender::gpu::shader::parser::ParserBase
Token operator[] (int i) const
void build_scope_tree (ErrorHandler &err_handler)
void build_token_to_scope_map ()
void parse_bsl (ErrorHandler &err_handler)
ast::LocalScope root () const
void print_ast () const
Public Member Functions inherited from blender::gpu::shader::parser::LexerBase
std::string_view token_types_str () const
void identify_keywords ()
void identify_template_tokens ()
void reset_template_tokens ()
Public Member Functions inherited from lexit::TokenBuffer
 TokenBuffer ()=default
 TokenBuffer (const std::string_view str, const CharClass char_class_table[128])
void process (const std::string_view str, const CharClass char_class_table[128])
void clear ()
 Discard all currently held data. Does not reallocate.
void reserve (const uint32_t count)
 Allocate backing memory for the given number of tokens and move currently held data.
void tokenize (const CharClass char_class_table[128])
 Tokenizes the input string by grouping contiguous characters of the same class.
void merge_complex_literals (bool bsl_template_angle_bracket_lexing=false)
 Merge complex literals such as floats, strings and comments.
void atomize_words (IdentifierMap &identifiers, const KeywordTable &keywords)
 Assign keyword types and atoms for a small set of identifier.
void compute_lengths ()
 Compute small token length for speeding up certain tasks.
uint32_t size () const
 Return the amount of token inside the buffer.
std::string_view substr (const Token &start, const Token &end, const bool with_trailing_whitespaces=false) const
 Return the substring between the start and end tokens (included).
void append (TokenType type, TokenAtom atom, int32_t str_size, int32_t str_size_with_witespaces)
 Append a Token at the end of the buffer.
Token operator[] (int index) const
TokenMut operator[] (int index)
TokenIt begin ()
TokenIt end ()
Token front ()
Token back ()

Public Attributes

Language language = Language::BLENDER_GLSL
Public Attributes inherited from blender::gpu::shader::parser::MutableString
std::string str_
std::vector< Mutation > mutations_
std::string last_substitution_failure
Public Attributes inherited from blender::gpu::shader::parser::ParserBase
int include_id = 0
std::string_view scope_types_str
std::vector< ScopeType > scope_types
std::vector< IndexRange > scope_ranges
std::vector< ScopeLinks > scope_links
std::vector< int > token_scope
std::vector< ast::NodeData > ast_nodes
Public Attributes inherited from lexit::TokenBuffer
std::string_view str_
AlignedArrayPtr< TokenType > types_
AlignedArrayPtr< uint32_t > offsets_
AlignedArrayPtr< uint32_t > offsets_end_
AlignedArrayPtr< uint8_t > lengths_
AlignedArrayPtr< TokenAtom > atoms_
uint32_t size_ = 0
uint32_t allocated_size_ = 0

Protected Attributes

ErrorHandler & report_error

Additional Inherited Members

Static Public Attributes inherited from blender::gpu::shader::parser::LexerBase
static const std::array< CharClass, 128 > bsl_char_class_table
static const std::array< CharClass, 128 > default_char_class_table

Detailed Description

template<typename LexerFn, typename ParserFn>
struct blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >

Definition at line 379 of file intermediate.hh.

Constructor & Destructor Documentation

◆ IntermediateForm() [1/2]

template<typename LexerFn, typename ParserFn>
blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >::IntermediateForm ( const std::string_view input,
ErrorHandler & report_error )
inline

Definition at line 386 of file intermediate.hh.

◆ IntermediateForm() [2/2]

template<typename LexerFn, typename ParserFn>
blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >::IntermediateForm ( ErrorHandler & report_error)
inline

Definition at line 392 of file intermediate.hh.

Member Function Documentation

◆ apply_mutations()

template<typename LexerFn, typename ParserFn>
bool blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >::apply_mutations ( const bool all_mutation_ordered = false)
inline

Definition at line 420 of file intermediate.hh.

◆ debug_print()

template<typename LexerFn, typename ParserFn>
void blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >::debug_print ( )
inline

Definition at line 452 of file intermediate.hh.

◆ debug_print_tokens()

template<typename LexerFn, typename ParserFn>
void blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >::debug_print_tokens ( )
inline

Definition at line 460 of file intermediate.hh.

◆ only_apply_mutations()

template<typename LexerFn, typename ParserFn>
bool blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >::only_apply_mutations ( const bool all_mutation_ordered = false)
inline

Definition at line 413 of file intermediate.hh.

◆ operator()()

template<typename LexerFn, typename ParserFn>
Scope blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >::operator() ( ) const
inline

Definition at line 404 of file intermediate.hh.

◆ parse()

template<typename LexerFn, typename ParserFn>
void blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >::parse ( ErrorHandler & report_error)
inline

Definition at line 436 of file intermediate.hh.

◆ result_get()

template<typename LexerFn, typename ParserFn>
const std::string & blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >::result_get ( const bool all_mutation_ordered = false)
inline

Definition at line 430 of file intermediate.hh.

◆ set_str()

template<typename LexerFn, typename ParserFn>
void blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >::set_str ( const std::string_view input)
inline

Definition at line 397 of file intermediate.hh.

Referenced by blender::gpu::tests::TestParser::TestParser().

Member Data Documentation

◆ language

template<typename LexerFn, typename ParserFn>
Language blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >::language = Language::BLENDER_GLSL

Definition at line 384 of file intermediate.hh.

Referenced by blender::gpu::tests::TestParser::TestParser().

◆ report_error

template<typename LexerFn, typename ParserFn>
ErrorHandler& blender::gpu::shader::parser::IntermediateForm< LexerFn, ParserFn >::report_error
protected

Definition at line 381 of file intermediate.hh.


The documentation for this struct was generated from the following file: