slang::syntax::PtrTokenOrSyntax struct

A token pointer or a syntax node.

Public functions

auto isToken() const -> bool
auto isNode() const -> bool
auto token() const -> parsing::Token*
Gets access to the object as a token (throwing an exception if it's not actually a token).
auto node() const -> SyntaxNode*
Gets access to the object as a syntax node (throwing an exception if it's not actually a syntax node).
auto range() const -> SourceRange
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.