slang::ast::SemanticFacts class

A helper class that can extract semantic AST information from tokens and syntax nodes.

Public static functions

static auto getVariableLifetime(parsing::Token token) -> std::optional<VariableLifetime>
Interprets a keyword token as a variable lifetime value.
static auto getDirection(parsing::TokenKind kind) -> ArgumentDirection
Interprets a token type as an argument direction value.
static auto getProceduralBlockKind(syntax::SyntaxKind kind) -> ProceduralBlockKind
Interprets a syntax kind as a procedural block kind.
static auto getDefinitionKind(syntax::SyntaxKind kind) -> DefinitionKind
Interprets a syntax kind as a definition kind.
static auto getEdgeKind(parsing::TokenKind kind) -> EdgeKind
Interprets an edge token as an EdgeKind value.
static auto getAssertKind(syntax::SyntaxKind kind) -> AssertionKind
Interprets a syntax kind as an assertion kind.
static auto getStatementBlockKind(const syntax::BlockStatementSyntax& syntax) -> StatementBlockKind
Gets the statement block kind from the given syntax node.
static auto getElabSystemTaskKind(parsing::Token token) -> ElabSystemTaskKind
Interprets a system name token as an elaboration system task kind.
static auto getPulseStyleKind(parsing::TokenKind kind) -> PulseStyleKind
Interprets a token type as a pulse style kind.
static auto getChargeStrength(parsing::TokenKind kind) -> ChargeStrength
Interprets a token type as a charge strength.
static auto getProcedureKindStr(ProceduralBlockKind kind) -> std::string_view
Gets the human-friendly string name of a procedural block kind.
static auto getDriveStrength(const syntax::NetStrengthSyntax& syntax) -> std::pair<std::optional<DriveStrength>, std::optional<DriveStrength>>
Gets the optional drive strength values associated with the given net strength syntax node.
static auto getTypeRestriction(syntax::ForwardTypeRestrictionSyntax& syntax) -> ForwardTypeRestriction
Gets the forward type restriction associated with the given syntax node.
static auto getTypeRestriction(const Type& type) -> ForwardTypeRestriction
Gets the forward type restriction that matches the given type.
static auto getTypeRestrictionText(ForwardTypeRestriction typeRestriction) -> std::string_view
Gets the human-friendly string name of the given forward type restriction kind.
static void populateTimeScale(TimeScale& timeScale, const Scope& scope, const syntax::TimeUnitsDeclarationSyntax& syntax, std::optional<SourceRange>& unitsRange, std::optional<SourceRange>& precisionRange, bool isFirst)
Populates the given timescale object with the appropriate values specified by the given syntax node.
static void populateTimeScale(std::optional<TimeScale>& timeScale, const Scope& scope, std::optional<TimeScale> directiveTimeScale, std::optional<SourceRange> unitsRange, std::optional<SourceRange> precisionRange)
Populates the given timescale object with the given values.
static auto isAllowedInModport(SymbolKind kind) -> bool

Function documentation

static void slang::ast::SemanticFacts::populateTimeScale(TimeScale& timeScale, const Scope& scope, const syntax::TimeUnitsDeclarationSyntax& syntax, std::optional<SourceRange>& unitsRange, std::optional<SourceRange>& precisionRange, bool isFirst)

Populates the given timescale object with the appropriate values specified by the given syntax node.

Reports errors if needed.

static void slang::ast::SemanticFacts::populateTimeScale(std::optional<TimeScale>& timeScale, const Scope& scope, std::optional<TimeScale> directiveTimeScale, std::optional<SourceRange> unitsRange, std::optional<SourceRange> precisionRange)

Populates the given timescale object with the given values.

Reports errors if the timescale is invalid.

static bool slang::ast::SemanticFacts::isAllowedInModport(SymbolKind kind)

Returns true if the given symbol kind is allowed in modports.