Blender V5.0
blender::gpu::shader::parser::Parser Struct Reference

#include <shader_parser.hh>

Public Member Functions

 Parser (const std::string &input, ParserData::report_callback &report_error, bool keep_whitespace=false)
void foreach_scope (ScopeType type, std::function< void(Scope)> callback)
void foreach_match (const std::string &pattern, std::function< void(const std::vector< Token >)> callback)
void foreach_token (const TokenType token_type, std::function< void(const Token)> callback)
void foreach_function (std::function< void(bool is_static, Token type, Token name, Scope args, bool is_const, Scope body)> callback)
std::string substr_range_inclusive (size_t start, size_t end)
std::string substr_range_inclusive (Token start, Token end)
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)
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 erase (size_t from, size_t to)
void erase (Token from, Token to)
void erase (Token tok)
void erase (Scope scope)
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)
void insert_line_number (Token at, int line)
void insert_before (size_t at, const std::string &content)
void insert_before (Token at, const std::string &content)
bool only_apply_mutations ()
bool apply_mutations ()
const std::string & result_get ()
const ParserDatadata_get ()
std::string serialize_mutations () const
void print_stats ()
void debug_print ()

Detailed Description

Definition at line 1222 of file shader_parser.hh.

Constructor & Destructor Documentation

◆ Parser()

blender::gpu::shader::parser::Parser::Parser ( const std::string & input,
ParserData::report_callback & report_error,
bool keep_whitespace = false )
inline

Definition at line 1253 of file shader_parser.hh.

References input.

Member Function Documentation

◆ apply_mutations()

bool blender::gpu::shader::parser::Parser::apply_mutations ( )
inline

Definition at line 1477 of file shader_parser.hh.

References only_apply_mutations().

◆ data_get()

const ParserData & blender::gpu::shader::parser::Parser::data_get ( )
inline

Definition at line 1494 of file shader_parser.hh.

◆ debug_print()

void blender::gpu::shader::parser::Parser::debug_print ( )
inline

Definition at line 1559 of file shader_parser.hh.

◆ erase() [1/4]

void blender::gpu::shader::parser::Parser::erase ( Scope scope)
inline

◆ erase() [2/4]

void blender::gpu::shader::parser::Parser::erase ( size_t from,
size_t to )
inline

◆ erase() [3/4]

void blender::gpu::shader::parser::Parser::erase ( Token from,
Token to )
inline

◆ erase() [4/4]

void blender::gpu::shader::parser::Parser::erase ( Token tok)
inline

Definition at line 1407 of file shader_parser.hh.

References erase().

◆ foreach_function()

void blender::gpu::shader::parser::Parser::foreach_function ( std::function< void(bool is_static, Token type, Token name, Scope args, bool is_const, Scope body)> callback)
inline

◆ foreach_match()

void blender::gpu::shader::parser::Parser::foreach_match ( const std::string & pattern,
std::function< void(const std::vector< Token >)> callback )
inline

◆ foreach_scope()

void blender::gpu::shader::parser::Parser::foreach_scope ( ScopeType type,
std::function< void(Scope)> callback )
inline

Definition at line 1263 of file shader_parser.hh.

References blender::gpu::shader::parser::Scope::from_position(), and pos.

Referenced by foreach_match().

◆ foreach_token()

void blender::gpu::shader::parser::Parser::foreach_token ( const TokenType token_type,
std::function< void(const Token)> callback )
inline

Definition at line 1279 of file shader_parser.hh.

References foreach_match(), and str.

◆ insert_after() [1/2]

void blender::gpu::shader::parser::Parser::insert_after ( size_t at,
const std::string & content )
inline

Definition at line 1418 of file shader_parser.hh.

Referenced by insert_after(), insert_before(), and insert_line_number().

◆ insert_after() [2/2]

void blender::gpu::shader::parser::Parser::insert_after ( Token at,
const std::string & content )
inline

◆ insert_before() [1/2]

void blender::gpu::shader::parser::Parser::insert_before ( size_t at,
const std::string & content )
inline

Definition at line 1437 of file shader_parser.hh.

◆ insert_before() [2/2]

void blender::gpu::shader::parser::Parser::insert_before ( Token at,
const std::string & content )
inline

◆ insert_line_number() [1/2]

void blender::gpu::shader::parser::Parser::insert_line_number ( size_t at,
int line )
inline

Definition at line 1428 of file shader_parser.hh.

References insert_after().

Referenced by insert_line_number().

◆ insert_line_number() [2/2]

void blender::gpu::shader::parser::Parser::insert_line_number ( Token at,
int line )
inline

◆ only_apply_mutations()

bool blender::gpu::shader::parser::Parser::only_apply_mutations ( )
inline

Definition at line 1448 of file shader_parser.hh.

Referenced by apply_mutations(), and result_get().

◆ print_stats()

void blender::gpu::shader::parser::Parser::print_stats ( )
inline

Definition at line 1550 of file shader_parser.hh.

◆ replace() [1/4]

void blender::gpu::shader::parser::Parser::replace ( Scope scope,
const std::string & replacement,
bool keep_trailing_whitespaces = false )
inline

◆ replace() [2/4]

void blender::gpu::shader::parser::Parser::replace ( size_t from,
size_t to,
const std::string & replacement )
inline

Definition at line 1352 of file shader_parser.hh.

References assert, and replace_try().

Referenced by erase(), replace(), replace(), and replace().

◆ replace() [3/4]

void blender::gpu::shader::parser::Parser::replace ( Token from,
Token to,
const std::string & replacement )
inline

◆ replace() [4/4]

void blender::gpu::shader::parser::Parser::replace ( Token tok,
const std::string & replacement,
bool keep_trailing_whitespaces = false )
inline

◆ replace_try() [1/2]

bool blender::gpu::shader::parser::Parser::replace_try ( size_t from,
size_t to,
const std::string & replacement )
inline

Definition at line 1327 of file shader_parser.hh.

Referenced by replace(), and replace_try().

◆ replace_try() [2/2]

bool blender::gpu::shader::parser::Parser::replace_try ( Token from,
Token to,
const std::string & replacement,
bool keep_trailing_whitespaces = false )
inline

◆ result_get()

const std::string & blender::gpu::shader::parser::Parser::result_get ( )
inline

Definition at line 1487 of file shader_parser.hh.

References only_apply_mutations().

◆ serialize_mutations()

std::string blender::gpu::shader::parser::Parser::serialize_mutations ( ) const
inline

Definition at line 1500 of file shader_parser.hh.

References out.

◆ substr_range_inclusive() [1/2]

std::string blender::gpu::shader::parser::Parser::substr_range_inclusive ( size_t start,
size_t end )
inline

Definition at line 1316 of file shader_parser.hh.

Referenced by substr_range_inclusive().

◆ substr_range_inclusive() [2/2]

std::string blender::gpu::shader::parser::Parser::substr_range_inclusive ( Token start,
Token end )
inline

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