Blender V5.3
blender::gpu::shader::parser::ast::Node Struct Reference

#include <ast.hh>

Inherited by blender::gpu::shader::parser::ast::AccessSpecifier, blender::gpu::shader::parser::ast::ArrayDecl, blender::gpu::shader::parser::ast::AssignStmt, blender::gpu::shader::parser::ast::Attr, blender::gpu::shader::parser::ast::AttrList, blender::gpu::shader::parser::ast::BitField, blender::gpu::shader::parser::ast::ClassDecl, blender::gpu::shader::parser::ast::Condition, blender::gpu::shader::parser::ast::Const, blender::gpu::shader::parser::ast::Constructor, blender::gpu::shader::parser::ast::Declarator, blender::gpu::shader::parser::ast::DesignatedInitializer, blender::gpu::shader::parser::ast::DoWhileLoop, blender::gpu::shader::parser::ast::ElseIfStmt, blender::gpu::shader::parser::ast::ElseStmt, blender::gpu::shader::parser::ast::EnumValue, blender::gpu::shader::parser::ast::Expr, blender::gpu::shader::parser::ast::ExprSub, blender::gpu::shader::parser::ast::ForLoop, blender::gpu::shader::parser::ast::FuncArg, blender::gpu::shader::parser::ast::FuncArgList, blender::gpu::shader::parser::ast::FuncCall, blender::gpu::shader::parser::ast::FuncDecl, blender::gpu::shader::parser::ast::FuncForwardDecl, blender::gpu::shader::parser::ast::FuncParamList, blender::gpu::shader::parser::ast::Id, blender::gpu::shader::parser::ast::IdQualified, blender::gpu::shader::parser::ast::IdType, blender::gpu::shader::parser::ast::IfStmt, blender::gpu::shader::parser::ast::Initializer, blender::gpu::shader::parser::ast::InitializerList, blender::gpu::shader::parser::ast::LocalScope, blender::gpu::shader::parser::ast::LocalStmt, blender::gpu::shader::parser::ast::LocalVar, blender::gpu::shader::parser::ast::Namespace, blender::gpu::shader::parser::ast::NumConst, blender::gpu::shader::parser::ast::OpDeref, blender::gpu::shader::parser::ast::PipelineDecl, blender::gpu::shader::parser::ast::Preprocessor, blender::gpu::shader::parser::ast::Reference, blender::gpu::shader::parser::ast::ReturnStmt, blender::gpu::shader::parser::ast::StaticStmt, blender::gpu::shader::parser::ast::StructuredBinding, blender::gpu::shader::parser::ast::Subscript, blender::gpu::shader::parser::ast::SwitchCase, blender::gpu::shader::parser::ast::SwitchStmt, blender::gpu::shader::parser::ast::TemplateArg, blender::gpu::shader::parser::ast::TemplateArgList, blender::gpu::shader::parser::ast::TemplateDecl, blender::gpu::shader::parser::ast::TemplateExplicit, blender::gpu::shader::parser::ast::TemplateInst, blender::gpu::shader::parser::ast::TemplateParamList, blender::gpu::shader::parser::ast::TemplateSpec, blender::gpu::shader::parser::ast::UsingStmt, blender::gpu::shader::parser::ast::VarDecl, and blender::gpu::shader::parser::ast::WhileLoop.

Classes

struct  TypedChildIterator
struct  TypedChildRange
struct  RecursiveTypedIterator
struct  RecursiveTypedRange
struct  ChildIterator
struct  ChildRange

Public Member Functions

 Node ()=default
 Node (const ParserBase *p, NodeID id)
const NodeData * data () const
NodeType type () const
Token front () const
Token back () const
Node prev () const
Node next () const
Node parent () const
Node children () const
Node child_first () const
Node child_last () const
Node prev (NodeType type) const
Node next (NodeType type) const
Node parent (NodeType type) const
Node child_first (NodeType type) const
Node child_last (NodeType type) const
int child_count () const
bool is_empty () const
bool has_single_child () const
bool is_valid () const
std::string_view str () const
std::string_view str_full () const
void print_ast () const
bool operator== (NodeType type) const
bool operator!= (NodeType type) const
std::ostream & operator<< (std::ostream &os)
ChildRange children_range () const
template<typename NodeT>
TypedChildRange< NodeT > children_of_type () const
template<typename NodeT>
RecursiveTypedRange< NodeT > descendants_of_type () const

Public Attributes

const ParserBase * p = nullptr
NodeID id = -1

Detailed Description

Type-less, read-only interface to a AST node data. Can represent an invalid node.

Serves as a basis for typed node interfaces.

Definition at line 144 of file ast.hh.

Constructor & Destructor Documentation

◆ Node() [1/2]

◆ Node() [2/2]

blender::gpu::shader::parser::ast::Node::Node ( const ParserBase * p,
NodeID id )
inline

Definition at line 155 of file ast.hh.

References data(), id, p, str(), and type().

Member Function Documentation

◆ back()

◆ child_count()

◆ child_first() [1/2]

Node Node::child_first ( ) const

Definition at line 78 of file ast.cc.

References blender::gpu::shader::parser::ParserBase::ast_nodes, id, is_valid(), Node(), and p.

Referenced by blender::gpu::shader::parser::ast::FuncDecl::arguments(), blender::gpu::shader::parser::ast::FuncForwardDecl::arguments(), blender::gpu::shader::parser::ast::TemplateDecl::arguments(), blender::gpu::shader::parser::ast::ClassDecl::attributes(), blender::gpu::shader::parser::ast::FuncArg::attributes(), blender::gpu::shader::parser::ast::FuncDecl::attributes(), blender::gpu::shader::parser::ast::FuncForwardDecl::attributes(), blender::gpu::shader::parser::ast::LocalStmt::attributes(), blender::gpu::shader::parser::ast::VarDecl::attributes(), blender::gpu::shader::parser::ast::Node::ChildRange::begin(), blender::gpu::shader::parser::ast::Node::RecursiveTypedRange< NodeT >::begin(), blender::gpu::shader::parser::ast::Node::TypedChildRange< NodeT >::begin(), blender::gpu::shader::parser::ast::DoWhileLoop::body(), child_first(), children(), blender::gpu::shader::parser::ast::ElseIfStmt::condition(), blender::gpu::shader::parser::ast::ForLoop::condition(), blender::gpu::shader::parser::ast::IfStmt::condition(), blender::gpu::shader::parser::ast::SwitchStmt::condition(), blender::gpu::shader::parser::ast::WhileLoop::condition(), blender::gpu::shader::parser::ast::IdType::constant(), blender::gpu::shader::parser::ast::FuncArg::declarator(), blender::gpu::shader::parser::ast::AssignStmt::expr(), blender::gpu::shader::parser::ast::BitField::expr(), blender::gpu::shader::parser::ast::ExprSub::expr(), blender::gpu::shader::parser::ast::Subscript::expr(), blender::gpu::shader::parser::ast::IdQualified::has_namespace(), blender::gpu::shader::parser::ast::VarDecl::has_single_declarator(), blender::gpu::shader::parser::ast::Attr::identifier(), blender::gpu::shader::parser::ast::ClassDecl::identifier(), blender::gpu::shader::parser::ast::Constructor::identifier(), blender::gpu::shader::parser::ast::Declarator::identifier(), blender::gpu::shader::parser::ast::DesignatedInitializer::identifier(), blender::gpu::shader::parser::ast::EnumValue::identifier(), blender::gpu::shader::parser::ast::FuncCall::identifier(), blender::gpu::shader::parser::ast::IdType::identifier(), blender::gpu::shader::parser::ast::LocalVar::identifier(), blender::gpu::shader::parser::ast::Namespace::identifier(), blender::gpu::shader::parser::ast::UsingStmt::identifier(), bsl::ExpressionTypeParser::identifier(), bsl::SymbolParser::initialize_assign(), blender::gpu::shader::parser::ast::AssignStmt::initializer_list(), blender::gpu::shader::parser::ast::SwitchCase::is_default_case(), blender::gpu::shader::parser::ast::IdQualified::is_global(), blender::gpu::shader::parser::ast::VarDecl::is_reference(), blender::gpu::shader::parser::ast::FuncDecl::is_static(), blender::gpu::shader::parser::ast::FuncForwardDecl::is_static(), blender::gpu::shader::parser::ast::IdType::is_static(), bsl::SymbolScope::lookup_function_forward_decl(), bsl::SymbolTable::mangle_identifier(), blender::gpu::shader::parser::ast::IdQualified::namespace_start(), blender::gpu::shader::parser::ast::Attr::parameters(), bsl::SymbolParser::parse_structured_binding(), bsl::SymbolParser::parse_template_arguments(), bsl::SymbolParser::parse_var_decl(), blender::gpu::shader::parser::ast::Declarator::reference(), blender::gpu::shader::parser::ast::IdType::reference(), bsl::SymbolTable::resolve_auto_type(), bsl::resource_type_from_attributes(), blender::gpu::shader::parser::ast::FuncDecl::return_type(), blender::gpu::shader::parser::ast::FuncForwardDecl::return_type(), blender::gpu::shader::parser::ast::FuncParamList::splat_1(), blender::gpu::shader::parser::ast::FuncParamList::splat_2(), blender::gpu::shader::parser::ast::FuncParamList::splat_3(), blender::gpu::shader::parser::ast::FuncParamList::splat_4(), blender::gpu::shader::parser::ast::ArrayDecl::sub(), blender::gpu::shader::parser::ast::FuncArg::type(), blender::gpu::shader::parser::ast::PipelineDecl::type(), blender::gpu::shader::parser::ast::TemplateArg::type(), blender::gpu::shader::parser::ast::VarDecl::type(), and blender::gpu::shader::parser::ast::SwitchCase::value().

◆ child_first() [2/2]

Node Node::child_first ( NodeType type) const
inline

Definition at line 282 of file ast.hh.

References child_first(), Node(), node, and type().

◆ child_last() [1/2]

Node Node::child_last ( ) const

Definition at line 83 of file ast.cc.

References blender::gpu::shader::parser::ParserBase::ast_nodes, id, is_valid(), Node(), and p.

Referenced by blender::gpu::shader::parser::ast::UsingStmt::aliased(), blender::gpu::shader::parser::ast::Declarator::array(), blender::gpu::shader::parser::ast::DesignatedInitializer::assign(), blender::gpu::shader::parser::ast::StructuredBinding::assign(), blender::gpu::shader::parser::ast::ElseIfStmt::attributes(), blender::gpu::shader::parser::ast::IfStmt::attributes(), blender::gpu::shader::parser::ast::Declarator::bitfield(), blender::gpu::shader::parser::ast::ClassDecl::body(), blender::gpu::shader::parser::ast::ElseIfStmt::body(), blender::gpu::shader::parser::ast::ElseStmt::body(), blender::gpu::shader::parser::ast::ForLoop::body(), blender::gpu::shader::parser::ast::FuncDecl::body(), blender::gpu::shader::parser::ast::IfStmt::body(), blender::gpu::shader::parser::ast::Namespace::body(), blender::gpu::shader::parser::ast::SwitchCase::body(), blender::gpu::shader::parser::ast::WhileLoop::body(), child_last(), children(), blender::gpu::shader::parser::ast::DoWhileLoop::condition(), blender::gpu::shader::parser::ast::TemplateDecl::decl(), blender::gpu::shader::parser::ast::TemplateInst::decl(), blender::gpu::shader::parser::ast::TemplateSpec::decl(), blender::gpu::shader::parser::ast::LocalStmt::expr(), blender::gpu::shader::parser::ast::ReturnStmt::expression(), blender::gpu::shader::parser::ast::VarDecl::has_single_declarator(), blender::gpu::shader::parser::ast::TemplateArg::identifier(), blender::gpu::shader::parser::ast::Declarator::initial_value(), blender::gpu::shader::parser::ast::Constructor::initializer_list(), blender::gpu::shader::parser::ast::Declarator::initializer_list(), blender::gpu::shader::parser::ast::TemplateDecl::is_class(), blender::gpu::shader::parser::ast::TemplateInst::is_class(), blender::gpu::shader::parser::ast::TemplateSpec::is_class(), blender::gpu::shader::parser::ast::FuncDecl::is_const(), blender::gpu::shader::parser::ast::FuncForwardDecl::is_const(), blender::gpu::shader::parser::ast::TemplateDecl::is_function(), blender::gpu::shader::parser::ast::TemplateInst::is_function(), blender::gpu::shader::parser::ast::TemplateSpec::is_function(), blender::gpu::shader::parser::ast::IdQualified::name(), blender::gpu::shader::parser::ast::FuncCall::parameters(), blender::gpu::shader::parser::ast::PipelineDecl::parameters(), blender::gpu::shader::parser::ast::TemplateInst::parameters(), blender::gpu::shader::parser::ast::TemplateSpec::parameters(), bsl::SymbolParser::parse_template_inst(), blender::gpu::shader::parser::ast::IdQualified::template_params(), and blender::gpu::shader::parser::ast::EnumValue::value().

◆ child_last() [2/2]

Node Node::child_last ( NodeType type) const
inline

Definition at line 288 of file ast.hh.

References child_last(), Node(), node, and type().

◆ children()

Node blender::gpu::shader::parser::ast::Node::children ( ) const

◆ children_of_type()

◆ children_range()

Node::ChildRange Node::children_range ( ) const
inline

Definition at line 334 of file ast.hh.

Referenced by child_count(), and bsl::SymbolTable::mangle_identifier().

◆ data()

const NodeData * Node::data ( ) const

Definition at line 88 of file ast.cc.

References blender::gpu::shader::parser::ParserBase::ast_nodes, id, is_valid(), and p.

Referenced by Node().

◆ descendants_of_type()

template<typename NodeT>
Node::RecursiveTypedRange< NodeT > Node::descendants_of_type ( ) const
inline

Definition at line 426 of file ast.hh.

Referenced by bsl::SymbolParser::parse_loop_arguments().

◆ front()

◆ has_single_child()

bool Node::has_single_child ( ) const

Definition at line 64 of file ast.cc.

References blender::gpu::shader::parser::ParserBase::ast_nodes, id, and p.

Referenced by children().

◆ is_empty()

bool Node::is_empty ( ) const

Definition at line 98 of file ast.cc.

References blender::gpu::shader::parser::ParserBase::ast_nodes, id, and p.

Referenced by children().

◆ is_valid()

bool blender::gpu::shader::parser::ast::Node::is_valid ( ) const
inline

Definition at line 189 of file ast.hh.

Referenced by back(), child_first(), child_last(), blender::gpu::shader::parser::ast::AttrList::contains_attr(), data(), blender::gpu::shader::parser::ast::ArrayDecl::dimensions(), bsl::SymbolTable::expr_to_string(), bsl::SymbolTable::expr_type_analysis(), front(), blender::gpu::shader::parser::ast::IdQualified::has_namespace(), blender::gpu::shader::parser::ast::VarDecl::has_single_declarator(), bsl::ExpressionTypeParser::identifier(), blender::gpu::shader::parser::ast::ClassDecl::is_anonymous(), blender::gpu::shader::parser::ast::FuncDecl::is_const(), blender::gpu::shader::parser::ast::FuncForwardDecl::is_const(), blender::gpu::shader::parser::ast::IdType::is_const(), blender::gpu::shader::parser::ast::FuncDecl::is_method(), blender::gpu::shader::parser::ast::FuncForwardDecl::is_method(), blender::gpu::shader::parser::ast::Id::is_namespace(), blender::gpu::shader::parser::ast::Declarator::is_reference(), blender::gpu::shader::parser::ast::FuncDecl::is_static(), blender::gpu::shader::parser::ast::FuncForwardDecl::is_static(), blender::gpu::shader::parser::ast::IdType::is_static(), blender::gpu::shader::parser::ast::FuncDecl::is_template(), bsl::SymbolScope::lookup_function(), bsl::SymbolScope::lookup_function_forward_decl(), bsl::SymbolTable::mangle_identifier(), next(), parent(), bsl::SymbolParser::parse_enum_value(), bsl::SymbolParser::parse_structured_binding(), bsl::SymbolParser::parse_template_inst(), bsl::SymbolParser::parse_template_spec(), bsl::SymbolParser::parse_var_decl(), prev(), print_ast(), bsl::SymbolTable::resolve_auto_type(), bsl::resolve_template_instantiation(), bsl::resource_type_from_attributes(), str(), str_full(), bsl::CodegenContext::CodegenExpressionParser::subscript(), bsl::ExpressionTypeParser::subscript(), and type().

◆ next() [1/2]

◆ next() [2/2]

Node Node::next ( NodeType type) const

Definition at line 41 of file ast.cc.

References Node(), node, and type().

◆ operator!=()

bool blender::gpu::shader::parser::ast::Node::operator!= ( NodeType type) const
inline

Definition at line 205 of file ast.hh.

References type().

◆ operator<<()

std::ostream & blender::gpu::shader::parser::ast::Node::operator<< ( std::ostream & os)
inline

Definition at line 210 of file ast.hh.

References str().

◆ operator==()

bool blender::gpu::shader::parser::ast::Node::operator== ( NodeType type) const
inline

Definition at line 201 of file ast.hh.

References type().

◆ parent() [1/2]

◆ parent() [2/2]

Node Node::parent ( NodeType type) const

Definition at line 55 of file ast.cc.

References Node(), node, and type().

◆ prev() [1/2]

◆ prev() [2/2]

Node Node::prev ( NodeType type) const

Definition at line 27 of file ast.cc.

References Node(), node, and type().

◆ print_ast()

◆ str()

◆ str_full()

◆ type()

Member Data Documentation

◆ id

◆ p


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