slang::syntax::SyntaxFacts class

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

Public static functions

static SyntaxKind getUnaryPrefixExpression(TokenKind kind)
static SyntaxKind getUnaryPostfixExpression(TokenKind kind)
static SyntaxKind getLiteralExpression(TokenKind kind)
static SyntaxKind getBinaryExpression(TokenKind kind)
static SyntaxKind getBinarySequenceExpr(TokenKind kind)
static SyntaxKind getBinaryPropertyExpr(TokenKind kind)
static SyntaxKind getKeywordNameExpression(TokenKind kind)
static SyntaxKind getIntegerType(TokenKind kind)
static SyntaxKind getKeywordType(TokenKind kind)
static SyntaxKind getProceduralBlockKind(TokenKind kind)
static SyntaxKind getModuleDeclarationKind(TokenKind kind)
static SyntaxKind getModuleHeaderKind(TokenKind kind)
static TokenKind getModuleEndKind(TokenKind kind)
static TokenKind getDelimCloseKind(TokenKind kind)
static TokenKind getSkipToKind(TokenKind kind)
static int getPrecedence(SyntaxKind kind)
static bool isSpecialMethodName(SyntaxKind kind)
static bool isRightAssociative(SyntaxKind kind)
static bool isPossibleDataType(TokenKind kind)
static bool isPossibleExpression(TokenKind kind)
static bool isPossibleStatement(TokenKind kind)
static bool isNetType(TokenKind kind)
static bool isPortDirection(TokenKind kind)
static bool isPossibleArgument(TokenKind kind)
static bool isPossibleParamAssignment(TokenKind kind)
static bool isOpenDelimOrKeyword(TokenKind kind)
static bool isCloseDelimOrKeyword(TokenKind kind)
static bool isComma(TokenKind kind)
static bool isSemicolon(TokenKind kind)
static bool isCloseBrace(TokenKind kind)
static bool isIdentifierOrComma(TokenKind kind)
static bool isNotIdOrComma(TokenKind kind)
static bool isPossibleExpressionOrComma(TokenKind kind)
static bool isPossibleExpressionOrCommaOrDefault(TokenKind kind)
static bool isPossibleExpressionOrTripleAnd(TokenKind kind)
static bool isPossibleExpressionOrEquals(TokenKind kind)
static bool isPossibleForInitializer(TokenKind kind)
static bool isPossibleValueRangeElement(TokenKind kind)
static bool isPossiblePattern(TokenKind kind)
static bool isPossiblePatternOrComma(TokenKind kind)
static bool isPossibleDelayOrEventControl(TokenKind kind)
static bool isPossibleInstance(TokenKind kind)
static bool isPossibleUdpEntry(TokenKind kind)
static bool isPossibleRsRule(TokenKind kind)
static bool isPossibleStructMember(TokenKind kind)
static bool isEndKeyword(TokenKind kind)
static bool isDeclarationModifier(TokenKind kind)
static bool isLifetimeModifier(TokenKind kind)
static bool isMemberQualifier(TokenKind kind)
static bool isMethodQualifier(TokenKind kind)
static bool isPropertyQualifier(TokenKind kind)
static bool isConstraintQualifier(TokenKind kind)
static bool isDriveStrength(TokenKind kind)
static bool isChargeStrength(TokenKind kind)
static bool isGateType(TokenKind kind)
static bool isEndOfParenList(TokenKind kind)
static bool isEndOfBracedList(TokenKind kind)
static bool isEndOfBracketedList(TokenKind kind)
static bool isEndOfCaseItem(TokenKind kind)
static bool isEndOfConditionalPredicate(TokenKind kind)
static bool isEndOfAttribute(TokenKind kind)
static bool isEndOfParameterList(TokenKind kind)
static bool isEndOfTransSet(TokenKind kind)
static bool isNotInType(TokenKind kind)
static bool isNotInPortReference(TokenKind kind)
static bool isNotInConcatenationExpr(TokenKind kind)
static bool isNotInParameterList(TokenKind kind)
static bool isPossiblePropertyPortItem(TokenKind kind)
static bool isPossibleAnsiPort(TokenKind kind)
static bool isPossibleNonAnsiPort(TokenKind kind)
static bool isPossibleUdpPort(TokenKind kind)
static bool isPossibleModportPort(TokenKind kind)
static bool isPossibleFunctionPort(TokenKind kind)
static bool isPossibleParameter(TokenKind kind)
static bool isPossiblePortConnection(TokenKind kind)
static bool isPossibleVectorDigit(TokenKind kind)
static bool isPossibleLetPortItem(TokenKind kind)
static bool isPossibleTransSet(TokenKind kind)
static bool isPossibleTimingCheckArg(TokenKind kind)
static bool isPossibleEdgeDescriptor(TokenKind kind)
static bool isBeforeOrSemicolon(TokenKind kind)
static bool isMatchingDelims(TokenKind openKind, TokenKind closeKind)
static bool isModifierAllowedAfter(TokenKind mod, TokenKind prev)
static bool isAllowedInCompilationUnit(SyntaxKind kind)
static bool isAllowedInGenerate(SyntaxKind kind)
static bool isAllowedInModule(SyntaxKind kind)
static bool isAllowedInInterface(SyntaxKind kind)
static bool isAllowedInProgram(SyntaxKind kind)
static bool isAllowedInAnonymousProgram(SyntaxKind kind)
static bool isAllowedInPackage(SyntaxKind kind)
static bool isAllowedInClocking(SyntaxKind kind)
static bool isAllowedInChecker(SyntaxKind kind)
static bool isStrength0(TokenKind kind)
static bool isStrength1(TokenKind kind)
static bool isAssignmentOperator(SyntaxKind kind)
static std::string_view getSimpleTypeName(const DataTypeSyntax& syntax)

Function documentation

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

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

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

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

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

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

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

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

static SyntaxKind slang::syntax::SyntaxFacts::getBinarySequenceExpr(TokenKind kind)

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

static SyntaxKind slang::syntax::SyntaxFacts::getBinaryPropertyExpr(TokenKind kind)

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

static SyntaxKind slang::syntax::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::syntax::SyntaxFacts::getIntegerType(TokenKind kind)

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

static SyntaxKind slang::syntax::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::syntax::SyntaxFacts::getProceduralBlockKind(TokenKind kind)

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

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

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

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

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

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

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

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

Returns the corresponding closing delimiter for the given opening delimiter.

static TokenKind slang::syntax::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::syntax::SyntaxFacts::getPrecedence(SyntaxKind kind)

Returns the operator precedence for the given expression syntax kind.

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

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

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

Returns true if the given expression kind is right associative.

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

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

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

Returns true if the given token represents a possible expression.

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

Returns true if the given token represents a possible statement.

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

Returns true if the given token represents a net type.

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

Returns true if the given token represents a port direction.

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

Returns true if the given token represents a possible argument.

static bool slang::syntax::SyntaxFacts::isPossibleParamAssignment(TokenKind kind)

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

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

Returns true if the given token represents an opening delimiter.

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

Returns true if the given token represents a closing delimiter.

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

Returns true if the given token represents a comma.

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

Returns true if the given token represents a semicolon.

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

Returns true if the given token represents a closing brace.

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

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

static bool slang::syntax::SyntaxFacts::isNotIdOrComma(TokenKind kind)

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

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

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

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

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

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

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

static bool slang::syntax::SyntaxFacts::isPossibleExpressionOrEquals(TokenKind kind)

Returns true if the given token represents a possible expression or an equals sign.

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

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

static bool slang::syntax::SyntaxFacts::isPossibleValueRangeElement(TokenKind kind)

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

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

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

static bool slang::syntax::SyntaxFacts::isPossiblePatternOrComma(TokenKind kind)

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

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

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

static bool slang::syntax::SyntaxFacts::isPossibleInstance(TokenKind kind)

Returns true if the given token represents a possible instance.

static bool slang::syntax::SyntaxFacts::isPossibleUdpEntry(TokenKind kind)

Returns true if the given token represents a possible UDP body entry.

static bool slang::syntax::SyntaxFacts::isPossibleRsRule(TokenKind kind)

Returns true if the given token represents a possible randsequence production rule.

static bool slang::syntax::SyntaxFacts::isPossibleStructMember(TokenKind kind)

Returns true if the given token represents a possible struct member.

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

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

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

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

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

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

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

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

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

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

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

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

static bool slang::syntax::SyntaxFacts::isConstraintQualifier(TokenKind kind)

Returns true if the given token is a valid qualifier for a constraint block.

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

Returns true if the given token is a drive strength.

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

Returns true if the given token is a charge strength.

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

Returns true if the given token is a gate type.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static bool slang::syntax::SyntaxFacts::isPossibleUdpPort(TokenKind kind)

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

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

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

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

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

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

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

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

Returns true if the given token represents a port connection.

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

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

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

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

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

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

static bool slang::syntax::SyntaxFacts::isPossibleTimingCheckArg(TokenKind kind)

Returns true if the given token represents a possible timing check argument.

static bool slang::syntax::SyntaxFacts::isPossibleEdgeDescriptor(TokenKind kind)

Returns true if the given token represents a possible edge descriptor.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static bool slang::syntax::SyntaxFacts::isAllowedInAnonymousProgram(SyntaxKind kind)

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

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

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

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

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

static bool slang::syntax::SyntaxFacts::isAllowedInChecker(SyntaxKind kind)

Returns true if the given syntax node is allowed within a checker declaration.

static bool slang::syntax::SyntaxFacts::isStrength0(TokenKind kind)

Returns true if the given token kind is a drive strength for value '0'.

static bool slang::syntax::SyntaxFacts::isStrength1(TokenKind kind)

Returns true if the given token kind is a drive strength for value '1'.

static bool slang::syntax::SyntaxFacts::isAssignmentOperator(SyntaxKind kind)

Returns true if the given syntax kind is an assignment operator.

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

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