slang::parsing::ParserMetadata struct

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 variables

flat_hash_map<const syntax::SyntaxNode*, Node> nodeMap
Specific metadata that was in effect when certain syntax nodes were parsed (such as various bits of preprocessor state).
flat_hash_set<std::string_view> globalInstances
A set 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.

Variable documentation

flat_hash_set<std::string_view> slang::parsing::ParserMetadata::globalInstances

A set 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.

Token slang::parsing::ParserMetadata::eofToken

The EOF token, if one has already been consumed by the parser.

Otherwise an empty token.