struct
#include <slang/parsing/ParserMetadata.h>
ParserMetadata 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 auto fromSyntax(const syntax::
SyntaxNode& root) -> ParserMetadata - Constructs a new set of parser metadata by walking the provided syntax tree.
Public functions
-
void addGlobalInstance(std::
string_view name) - Adds a global instance to the metadata if it hasn't already been seen.
-
auto getDeclaredSymbols() const -> std::
vector<std:: string_view> - Returns a list of all symbols from visitDeclaredSymbols.
-
void visitDeclaredSymbols(function_
ref<void(std:: string_view)> func) const - Visits top level symbols declared in this metadata, calling the provided function with the name.
-
auto getReferencedSymbols() const -> std::
vector<std:: string_view> - Returns a list of all symbols from visitReferencedSymbols.
-
void visitReferencedSymbols(function_
ref<void(std:: string_view)> func) const - Visits all top level symbols referenced/used by this metadata, calling the provided function for each symbol name.
Public variables
-
std::
vector<std:: pair<const syntax:: SyntaxNode*, Node>> nodeMeta - Specific metadata that was in effect when certain syntax nodes were parsed (such as various bits of preprocessor state).
-
std::
vector<std:: string_view> globalInstances - A list of names of all instantiations of global modules/interfaces/programs.
-
std::
vector<const syntax:: IdentifierNameSyntax*> classPackageNames - A list of all names parsed that could represent a package or class name, since they are simple names that appear on the left-hand side of a double colon.
-
std::
vector<const syntax:: PackageImportDeclarationSyntax*> packageImports - A list of all package import declarations parsed.
-
std::
vector<const syntax:: ClassDeclarationSyntax*> classDecls - A list of all class declarations parsed.
-
std::
vector<const syntax:: InterfacePortHeaderSyntax*> interfacePorts - A list of all interface port headers 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) const
Visits top level symbols declared in this metadata, calling the provided function with the name.
This includes modules, classes, packages, and interfaces.
Variable documentation
std:: vector<std:: string_view> slang:: parsing:: ParserMetadata:: globalInstances
A list of names of all instantiations of global modules/interfaces/programs.
This can be used to determine which modules should be considered as top-level roots of the design.