Skip to main content

Module declarations

Module declarations 

Source
Expand description

The C++ declaration walk, including the macro-sentinel error recovery.

Every function here is a pure function of a parsed tree and its source text. analyzer/cpp/adapter.rs in brokk-bifrost-analysis drives CppVisitor out of LanguageAdapter::parse_file.

Structs§

CppBaseSpecifierFact
CppComparableParameter
CppDisplacedPreprocessorBoundary
The effective end of a conditional whose real terminator tree-sitter displaced into declaration recovery.
CppNamespaceForwardScan
The namespace forward declarations one tree’s prefix holds, folded in as the walk asks about them.
CppPartitionedRegion
One owned container reparse deferred until the primary declaration walk has reached its source position. The tree and context are owned so the deferred walk never retains a Node borrowed from a temporary recovery tree.
CppRecoveredExportClassIndex
One file’s embedded export-macro class recovery, resolved once and keyed by the ERROR node that mints each set.
CppRecoveryCapture
What one open CppVisitor::record_recovered_declarations has watched happen to the declaration set.
CppSentinelRecoveredClass
CppSentinelRecoveredOwner
Owned structural recovery metadata for a namespace-sentinel region.
CppTemplateParameterNameMatches
CppTreeIdentity
Which tree a CppNamespaceForwardScan was folded out of.
CppUsingDeclarationBinding
One using ns::Type; declaration at namespace scope: the name it introduces and the canonical namespace of the entity it names.
CppVisitor
ScopeInfo

Enums§

CppAccessSpecifier
CppComparableNode
CppComparableSlot
CppFormalRole
A grammar role for one direct child of a C or C++ parameter list. Invalid and stopped classifications are separate from a valid empty list.
CppFormalRoleError
CppParameterType
One callable parameter’s parser-derived type.
ObjectMacroFieldEvent
One source-order event from an object-like field-list macro environment.

Functions§

collect_cpp_object_macro_field_events
Collect object-like field-list macro events in source order. Conditional branches remain visible in the event stream: callers that cannot prove branch selection can invalidate names conservatively instead of inventing a replacement from one branch.
cpp_callable_declaration_return_type_identity
Return the structured declared result type of one callable declaration.
cpp_callable_declaration_return_type_node
Return the AST node that describes one callable’s declared result type.
cpp_callable_parameter_type_identities
The structured type of each invocation parameter, in declaration order.
cpp_colon_source_aliases
Fully-kinded identities a C++ source spelling joined only by :: can name.
cpp_comparable_parameter_shapes
The comparable shape of each invocation parameter, in declaration order.
cpp_declaration_has_native_must_use_attribute
Whether one declaration carries a native must-use attribute.
cpp_declaration_type_identity
The parser-derived type of one declared object or parameter.
cpp_displaced_preprocessor_boundary
cpp_displaced_preprocessor_branch
The first #else/#elif of conditional that tree-sitter displaced into an ERROR inside the conditional’s own branch.
cpp_displaced_preprocessor_terminator
The real #endif that tree-sitter consumed inside an error subtree.
cpp_export_macro_token
cpp_field_declaration_linkage
Classify a C++ field while its declaration syntax is already available.
cpp_formal_role_with_step
Classify a structurally selected list child. A bare void is valid only when it is the sole parameter; a typed pack keeps its declaration node.
cpp_function_declarator_at
The callable declarator of the declaration that covers start_byte.
cpp_member_fq
Structured name for a member unit (function, field, enumerator). The short_name is the owning $-joined nested-class Type chain followed, when the member has an owner, by .member; free functions and globals have no owner and no ., so the whole short_name is the terminal SegmentKind::Member. C++ member names never contain a literal ., so the single . (if any) separates the owner chain from the member.
cpp_recovered_type_parameter_name
The name of a defaulted type parameter that tree-sitter-cpp recovered as a non-type parameter. The grammar’s default_type cannot hold an abstract declarator, so typename U = T* always recovers the * as an ERROR sibling; since grammar 0.24.4 the parameter itself also becomes an optional_parameter_declaration with type: dependent_type(typename U), no declarator and default_value: T. A valid dependent type names a qualified type after typename, so a bare type identifier there is the type parameter’s name.
cpp_rendered_name_fq
Structured name for a rendered C++ qualified name supplied at the input edge, such as an Analyzer::definitions("ns.Outer$Inner") argument.
cpp_sentinel_recovered_classes
Recover the class and out-of-line owner scopes from every malformed namespace-sentinel region in root.
cpp_sentinel_recovered_scope_for_node
Resolve the lexical scope restored for a node in a malformed namespace-sentinel region. Owner spans (out-of-line member definitions) outrank class spans, which in turn outrank the surviving namespace body. The class ancestor suffix is recovered from the original CST so nested members keep their complete Outer::Inner owner chain.
cpp_structured_type_path
The dot-free name components a qualified C++ name node writes, outermost first.
cpp_template_parameter_name_matches
cpp_template_term
cpp_type_field_contains_node
cpp_unclosed_construct_openers
The opening tokens of the constructs a C/C++ parse left open at the end of the file, in source order (#3501). Empty unless the tree’s root is an ERROR node.
direct_identifier_name
Normalize the text of a directly selected C++ identifier node.
enclosing_cpp_namespace_nodes
The namespace definition ancestors of node, ordered from outermost to innermost.
is_direct_recovered_exported_class_field_declaration
is_macro_wrapped_declaration_envelope
Whether node is an envelope an attribute-like macro invocation left where declarations were written: the declaration-scope ERROR [macro_wrapped_declarations] reads, or the collapsed run [collapsed_macro_declaration_run] reads.
is_recovered_exported_class_base_type_node
Whether node is the base type displaced into the declarator field of an export-macro class that tree-sitter represented as a declaration or function definition.
is_recovered_exported_class_container
is_recovered_fragmented_partial_specialization_container
Whether node is the function-shaped parser wrapper whose body was recovered as a fragmented partial-specialization class body.
node_text
Verbatim source text spanned by node, or "" when the byte range is not a valid str boundary (adversarial or partially-parsed input).
normalize_cpp_whitespace
recovered_callable_body_at
Whether the source a recovered callable’s byte range spells is a definition (a declarator with a body) rather than a declaration.
recovered_macro_return_type_node
Recognize the phantom field tree-sitter emits for a macro-qualified function return type. For example, static API result_type ThresholdForSmallA() { ... } can become a field_declaration (API as the type and result_type as a field name) followed by a clean function_definition for ThresholdForSmallA.