slang::syntax::PtrTokenOrSyntax struct

A token pointer or a syntax node.

Public functions

bool isToken() const
bool isNode() const
parsing::Token* token() const
Gets access to the object as a token (throwing an exception if it's not actually a token).
SyntaxNode* node() const
Gets access to the object as a syntax node (throwing an exception if it's not actually a syntax node).
SourceRange range() const
Gets the source range for the token or syntax node or NoLocation if it points to nullptr.

Function documentation

bool slang::syntax::PtrTokenOrSyntax::isToken() const

Returns true if the object is a token.

bool slang::syntax::PtrTokenOrSyntax::isNode() const

Returns true if the object is a syntax node.