slang::SyntaxFacts class

Contents

A collection of static methods that query various facts related to tokens and syntax nodes.

Public static functions

static auto getUnaryPrefixExpression(TokenKind kind) -> SyntaxKind
static auto getUnaryPostfixExpression(TokenKind kind) -> SyntaxKind
static auto getLiteralExpression(TokenKind kind) -> SyntaxKind
static auto getBinaryExpression(TokenKind kind) -> SyntaxKind
static auto getKeywordNameExpression(TokenKind kind) -> SyntaxKind
static auto getIntegerType(TokenKind kind) -> SyntaxKind
static auto getKeywordType(TokenKind kind) -> SyntaxKind
static auto getProceduralBlockKind(TokenKind kind) -> SyntaxKind
static auto getModuleDeclarationKind(TokenKind kind) -> SyntaxKind
static auto getModuleHeaderKind(TokenKind kind) -> SyntaxKind
static auto getModuleEndKind(TokenKind kind) -> TokenKind
static auto getDelimCloseKind(TokenKind kind) -> TokenKind
static auto getSkipToKind(TokenKind kind) -> TokenKind
static auto getPrecedence(SyntaxKind kind) -> int
static auto isSpecialMethodName(SyntaxKind kind) -> bool
static auto isRightAssociative(SyntaxKind kind) -> bool
static auto isPossibleDataType(TokenKind kind) -> bool
static auto isPossibleExpression(TokenKind kind) -> bool
static auto isPossibleStatement(TokenKind kind) -> bool
static auto isNetType(TokenKind kind) -> bool
static auto isPortDirection(TokenKind kind) -> bool
static auto isPossibleArgument(TokenKind kind) -> bool
static auto isOpenDelimOrKeyword(TokenKind kind) -> bool
static auto isCloseDelimOrKeyword(TokenKind kind) -> bool
static auto isComma(TokenKind kind) -> bool
static auto isSemicolon(TokenKind kind) -> bool
static auto isCloseBrace(TokenKind kind) -> bool
static auto isIdentifierOrComma(TokenKind kind) -> bool
static auto isPossibleExpressionOrComma(TokenKind kind) -> bool
static auto isPossibleExpressionOrCommaOrDefault(TokenKind kind) -> bool
static auto isPossibleExpressionOrTripleAnd(TokenKind kind) -> bool
static auto isPossibleForInitializer(TokenKind kind) -> bool
static auto isPossibleOpenRangeElement(TokenKind kind) -> bool
static auto isPossiblePattern(TokenKind kind) -> bool
static auto isPossibleDelayOrEventControl(TokenKind kind) -> bool
static auto isPossibleGateInstance(TokenKind kind) -> bool
static auto isEndKeyword(TokenKind kind) -> bool
static auto isDeclarationModifier(TokenKind kind) -> bool
static auto isLifetimeModifier(TokenKind kind) -> bool
static auto isMemberQualifier(TokenKind kind) -> bool
static auto isMethodQualifier(TokenKind kind) -> bool
static auto isPropertyQualifier(TokenKind kind) -> bool
static auto isDriveStrength(TokenKind kind) -> bool
static auto isChargeStrength(TokenKind kind) -> bool
static auto isGateType(TokenKind kind) -> bool
static auto isEndOfParenList(TokenKind kind) -> bool
static auto isEndOfBracedList(TokenKind kind) -> bool
static auto isEndOfBracketedList(TokenKind kind) -> bool
static auto isEndOfCaseItem(TokenKind kind) -> bool
static auto isEndOfConditionalPredicate(TokenKind kind) -> bool
static auto isEndOfAttribute(TokenKind kind) -> bool
static auto isEndOfParameterList(TokenKind kind) -> bool
static auto isEndOfTransSet(TokenKind kind) -> bool
static auto isNotInType(TokenKind kind) -> bool
static auto isNotInPortReference(TokenKind kind) -> bool
static auto isNotInConcatenationExpr(TokenKind kind) -> bool
static auto isNotInParameterList(TokenKind kind) -> bool
static auto isPossiblePropertyPortItem(TokenKind kind) -> bool
static auto isPossibleAnsiPort(TokenKind kind) -> bool
static auto isPossibleNonAnsiPort(TokenKind kind) -> bool
static auto isPossibleModportPort(TokenKind kind) -> bool
static auto isPossibleFunctionPort(TokenKind kind) -> bool
static auto isPossibleParameter(TokenKind kind) -> bool
static auto isPossiblePortConnection(TokenKind kind) -> bool
static auto isPossibleVectorDigit(TokenKind kind) -> bool
static auto isPossibleLetPortItem(TokenKind kind) -> bool
static auto isPossibleTransSet(TokenKind kind) -> bool
static auto isBeforeOrSemicolon(TokenKind kind) -> bool
static auto isMatchingDelims(TokenKind openKind, TokenKind closeKind) -> bool
static auto isModifierAllowedAfter(TokenKind mod, TokenKind prev) -> bool
static auto isAllowedInCompilationUnit(SyntaxKind kind) -> bool
static auto isAllowedInGenerate(SyntaxKind kind) -> bool
static auto isAllowedInModule(SyntaxKind kind) -> bool
static auto isAllowedInInterface(SyntaxKind kind) -> bool
static auto isAllowedInProgram(SyntaxKind kind) -> bool
static auto isAllowedInPackage(SyntaxKind kind) -> bool
static auto isAllowedInClocking(SyntaxKind kind) -> bool
static auto getSimpleTypeName(const DataTypeSyntax& syntax) -> string_view

Function documentation

static SyntaxKind slang::SyntaxFacts::getUnaryPrefixExpression(TokenKind kind)

Returns the kind of syntax that should be created for the given unary prefix operator token.

static SyntaxKind slang::SyntaxFacts::getUnaryPostfixExpression(TokenKind kind)

Returns the kind of syntax that should be created for the given unary postfix operator token.

static SyntaxKind slang::SyntaxFacts::getLiteralExpression(TokenKind kind)

Returns the kind of syntax that should be created for the given literal token.

static SyntaxKind slang::SyntaxFacts::getBinaryExpression(TokenKind kind)

Returns the kind of syntax that should be created for the given binary operator token.

static SyntaxKind slang::SyntaxFacts::getKeywordNameExpression(TokenKind kind)

Returns the kind of syntax that should be created for the given name keyword token (like "this" or "super").

static SyntaxKind slang::SyntaxFacts::getIntegerType(TokenKind kind)

Returns the kind of syntax that should be created for the given built-in integer keyword token.

static SyntaxKind slang::SyntaxFacts::getKeywordType(TokenKind kind)

Returns the kind of syntax that should be created for the given built-in non-integer keyword token.

static SyntaxKind slang::SyntaxFacts::getProceduralBlockKind(TokenKind kind)

Returns the kind of syntax that should be created for the given block token.

static SyntaxKind slang::SyntaxFacts::getModuleDeclarationKind(TokenKind kind)

Returns the kind of syntax that should be created for the given module / program / interface token.

static SyntaxKind slang::SyntaxFacts::getModuleHeaderKind(TokenKind kind)

Returns the kind of syntax that should be created for the given module / program / interface header token.

static TokenKind slang::SyntaxFacts::getModuleEndKind(TokenKind kind)

Returns the corresponding end token for the opening module / program / interface token.

static TokenKind slang::SyntaxFacts::getDelimCloseKind(TokenKind kind)

Returns the corresponding closing delimiter for the given opening delimiter.

static TokenKind slang::SyntaxFacts::getSkipToKind(TokenKind kind)

Returns the preferred token to skip to given the current token being observed (for skipping over invalid / error spans).

static int slang::SyntaxFacts::getPrecedence(SyntaxKind kind)

Returns the operator precedence for the given expression syntax kind.

static bool slang::SyntaxFacts::isSpecialMethodName(SyntaxKind kind)

Returns true if the given syntax is a special method name (like built-in array manipulation methods).

static bool slang::SyntaxFacts::isRightAssociative(SyntaxKind kind)

Returns true if the given expression kind is right associative.

static bool slang::SyntaxFacts::isPossibleDataType(TokenKind kind)

Returns true if the given token represents a possible data type expression.

static bool slang::SyntaxFacts::isPossibleExpression(TokenKind kind)

Returns true if the given token represents a possible expression.

static bool slang::SyntaxFacts::isPossibleStatement(TokenKind kind)

Returns true if the given token represents a possible statement.

static bool slang::SyntaxFacts::isNetType(TokenKind kind)

Returns true if the given token represents a net type.

static bool slang::SyntaxFacts::isPortDirection(TokenKind kind)

Returns true if the given token represents a port direction.

static bool slang::SyntaxFacts::isPossibleArgument(TokenKind kind)

Returns true if the given token represents a possible argument.

static bool slang::SyntaxFacts::isOpenDelimOrKeyword(TokenKind kind)

Returns true if the given token represents an opening delimiter.

static bool slang::SyntaxFacts::isCloseDelimOrKeyword(TokenKind kind)

Returns true if the given token represents a closing delimiter.

static bool slang::SyntaxFacts::isComma(TokenKind kind)

Returns true if the given token represents a comma.

static bool slang::SyntaxFacts::isSemicolon(TokenKind kind)

Returns true if the given token represents a semicolon.

static bool slang::SyntaxFacts::isCloseBrace(TokenKind kind)

Returns true if the given token represents a closing brace.

static bool slang::SyntaxFacts::isIdentifierOrComma(TokenKind kind)

Returns true if the given token represents an identifier or a comma.

static bool slang::SyntaxFacts::isPossibleExpressionOrComma(TokenKind kind)

Returns true if the given token represents a possible expression or a comma.

static bool slang::SyntaxFacts::isPossibleExpressionOrCommaOrDefault(TokenKind kind)

Returns true if the given token represents a possible expression, comma, or "default" keyword.

static bool slang::SyntaxFacts::isPossibleExpressionOrTripleAnd(TokenKind kind)

Returns true if the given token represents a possible expression or "&&&" token.

static bool slang::SyntaxFacts::isPossibleForInitializer(TokenKind kind)

Returns true if the given token represents a possible for-statement variable initializer.

static bool slang::SyntaxFacts::isPossibleOpenRangeElement(TokenKind kind)

Returns true if the given token represents a possible open range element.

static bool slang::SyntaxFacts::isPossiblePattern(TokenKind kind)

Returns true if the given token represents a possible conditional pattern.

static bool slang::SyntaxFacts::isPossibleDelayOrEventControl(TokenKind kind)

Returns true if the given token represents a possible delay or event control.

static bool slang::SyntaxFacts::isPossibleGateInstance(TokenKind kind)

Returns true if the given token represents a possible gate instance.

static bool slang::SyntaxFacts::isEndKeyword(TokenKind kind)

Returns true if the given token is an ending keyword (like "endmodule", "endfunction", etc).

static bool slang::SyntaxFacts::isDeclarationModifier(TokenKind kind)

Returns true if the given token is a declaration modifier (like "const" or "static").

static bool slang::SyntaxFacts::isLifetimeModifier(TokenKind kind)

Returns true if the given token is a lifetime modifier (like "automatic" or "static").

static bool slang::SyntaxFacts::isMemberQualifier(TokenKind kind)

Returns true if the given token is a member qualifer (like "virtual" or "extern").

static bool slang::SyntaxFacts::isMethodQualifier(TokenKind kind)

Returns true if the given token is a valid qualifier for a class method.

static bool slang::SyntaxFacts::isPropertyQualifier(TokenKind kind)

Returns true if the given token is a valid qualifier for a class property.

static bool slang::SyntaxFacts::isDriveStrength(TokenKind kind)

Returns true if the given token is a drive strength.

static bool slang::SyntaxFacts::isChargeStrength(TokenKind kind)

Returns true if the given token is a charge strength.

static bool slang::SyntaxFacts::isGateType(TokenKind kind)

Returns true if the given token is a gate type.

static bool slang::SyntaxFacts::isEndOfParenList(TokenKind kind)

Returns true if the given token represents the end of a parenthesized list.

static bool slang::SyntaxFacts::isEndOfBracedList(TokenKind kind)

Returns true if the given token represents the end of a braced list.

static bool slang::SyntaxFacts::isEndOfBracketedList(TokenKind kind)

Returns true if the given token represents the end of a bracketed list.

static bool slang::SyntaxFacts::isEndOfCaseItem(TokenKind kind)

Returns true if the given token represents the end of a case item.

static bool slang::SyntaxFacts::isEndOfConditionalPredicate(TokenKind kind)

Returns true if the given token represents the end of a conditional predicate.

static bool slang::SyntaxFacts::isEndOfAttribute(TokenKind kind)

Returns true if the given token represents the end of an attribute.

static bool slang::SyntaxFacts::isEndOfParameterList(TokenKind kind)

Returns true if the given token represents the end of a parameter list.

static bool slang::SyntaxFacts::isEndOfTransSet(TokenKind kind)

Returns true if the given token represents a "trans" set.

static bool slang::SyntaxFacts::isNotInType(TokenKind kind)

Returns true if the given token is not valid in a data type.

static bool slang::SyntaxFacts::isNotInPortReference(TokenKind kind)

Returns true if the given token is not valid in a port reference.

static bool slang::SyntaxFacts::isNotInConcatenationExpr(TokenKind kind)

Returns true if the given token is not valid in a concatenation expression.

static bool slang::SyntaxFacts::isNotInParameterList(TokenKind kind)

Returns true if the given token is not valid in a parameter list.

static bool slang::SyntaxFacts::isPossiblePropertyPortItem(TokenKind kind)

Returns true if the given token represents a possible property port item.

static bool slang::SyntaxFacts::isPossibleAnsiPort(TokenKind kind)

Returns true if the given token represents a possible ansi port.

static bool slang::SyntaxFacts::isPossibleNonAnsiPort(TokenKind kind)

Returns true if the given token represents a possible non-ansi port.

static bool slang::SyntaxFacts::isPossibleModportPort(TokenKind kind)

Returns true if the given token represents a possible modport port.

static bool slang::SyntaxFacts::isPossibleFunctionPort(TokenKind kind)

Returns true if the given token represents a possible function port.

static bool slang::SyntaxFacts::isPossibleParameter(TokenKind kind)

Returns true if the given token represents a possible function parameter.

static bool slang::SyntaxFacts::isPossiblePortConnection(TokenKind kind)

Returns true if the given token represents a port connection.

static bool slang::SyntaxFacts::isPossibleVectorDigit(TokenKind kind)

Returns true if the given token represents a possible vector digit.

static bool slang::SyntaxFacts::isPossibleLetPortItem(TokenKind kind)

Returns true if the given token represents a "let" port item.

static bool slang::SyntaxFacts::isPossibleTransSet(TokenKind kind)

Returns true if the given token represents a possible "trans" set.

static bool slang::SyntaxFacts::isBeforeOrSemicolon(TokenKind kind)

Returns true if the given token is the "before" keyword or a semicolon.

static bool slang::SyntaxFacts::isMatchingDelims(TokenKind openKind, TokenKind closeKind)

Returns true if the given tokens are matching open / close delimiters.

static bool slang::SyntaxFacts::isModifierAllowedAfter(TokenKind mod, TokenKind prev)

Returns true if the given mod token is allowed after a token of kind prev

static bool slang::SyntaxFacts::isAllowedInCompilationUnit(SyntaxKind kind)

Returns true if the given syntax node is allowed within a compilation unit.

static bool slang::SyntaxFacts::isAllowedInGenerate(SyntaxKind kind)

Returns true if the given syntax node is allowed within a generate block or region.

static bool slang::SyntaxFacts::isAllowedInModule(SyntaxKind kind)

Returns true if the given syntax node is allowed within a module definition.

static bool slang::SyntaxFacts::isAllowedInInterface(SyntaxKind kind)

Returns true if the given syntax node is allowed within an interface definition.

static bool slang::SyntaxFacts::isAllowedInProgram(SyntaxKind kind)

Returns true if the given syntax node is allowed within a program definition.

static bool slang::SyntaxFacts::isAllowedInPackage(SyntaxKind kind)

Returns true if the given syntax node is allowed within a package definition.

static bool slang::SyntaxFacts::isAllowedInClocking(SyntaxKind kind)

Returns true if the given syntax node is allowed within a clocking block.

static string_view slang::SyntaxFacts::getSimpleTypeName(const DataTypeSyntax& syntax)

Returns a string representing the name of the given data type, if it has a simple name.