ParserMetadata struct
#include <slang/parsing/ParserMetadata.h>
Various bits of metadata collected during parsing.
Public types
- struct Node
- Collection of metadata that can be associated with a syntax node at parse time.
Public static functions
-
static ParserMetadata fromSyntax(const syntax::
SyntaxNode& root) - Constructs a new set of parser metadata by walking the provided syntax tree.
Public functions
-
std::
vector<std:: string_view> getDeclaredSymbols(bool includeNested = false) const - Returns a list of all symbols from visitDeclaredSymbols.
-
void visitDeclaredSymbols(function_
ref<void(std:: string_view)> func, bool includeNested = false) const - Visits compilation-unit module, interface, program, package, class, and checker declarations, calling the provided function with each unqualified name.
-
std::
vector<std:: string_view> getReferencedSymbols() const - Returns the unique symbol names from visitReferencedSymbols.
-
void visitReferencedSymbols(function_
ref<void(Token)> func, bool includeInterfacePorts = true) const - Visits all top level symbols referenced/used by this metadata, calling the provided function with each name token, including virtual interface types.
Public variables
-
std::
vector<std:: pair<const syntax:: ModuleDeclarationSyntax*, Node>> nodeMeta - Specific metadata that was in effect when certain syntax nodes were parsed (such as various bits of preprocessor state).
-
std::
vector<const syntax:: SyntaxNode*> decls - Class and checker declarations at any scope. Module-like declarations are in nodeMeta.
-
std::
vector<const syntax:: SyntaxNode*> refs - Potential dependency references: hierarchy and checker instantiations, identifier names preceding a double colon, package import declarations, and virtual interface types.
-
std::
vector<const syntax:: EnumTypeSyntax*> enumTypes - A list of all enum types parsed.
- Token eofToken
- The EOF token, if one has already been consumed by the parser.
- bool hasDefparams
- Indicates whether the parse tree has any defparam directives.
- bool hasBindDirectives
- Indicates whether the parse tree has any bind directives.
Function documentation
void slang:: parsing:: ParserMetadata:: visitDeclaredSymbols(function_ ref<void(std:: string_view)> func,
bool includeNested = false) const
Visits compilation-unit module, interface, program, package, class, and checker declarations, calling the provided function with each unqualified name.
If includeNested is true, also includes declarations within other scopes.
void slang:: parsing:: ParserMetadata:: visitReferencedSymbols(function_ ref<void(Token)> func,
bool includeInterfacePorts = true) const
Visits all top level symbols referenced/used by this metadata, calling the provided function with each name token, including virtual interface types.
Tokens retain source locations so callers can resolve dependencies relative to the referencing file. If includeInterfacePorts is true, also includes explicit interface port types.
Variable documentation
std:: vector<const syntax:: SyntaxNode*> slang:: parsing:: ParserMetadata:: refs
Potential dependency references: hierarchy and checker instantiations, identifier names preceding a double colon, package import declarations, and virtual interface types.
Hierarchy instantiations are included only for global modules/interfaces/programs.