template<typename TNode>
slang::TokenOrSyntaxBase struct

A base class template for a sum type representing either a token or a syntax node.

Contents

Public functions

auto isToken() const -> bool
auto isNode() const -> bool
auto token() const -> Token
auto node() const -> TNode

Function documentation

template<typename TNode>
bool slang::TokenOrSyntaxBase<TNode>::isToken() const

Returns true if the object is a token.

template<typename TNode>
bool slang::TokenOrSyntaxBase<TNode>::isNode() const

Returns true if the object is a syntax node.

template<typename TNode>
Token slang::TokenOrSyntaxBase<TNode>::token() const

Gets access to the object as a token (throwing an exception if it's not actually a token).

template<typename TNode>
TNode slang::TokenOrSyntaxBase<TNode>::node() const

Gets access to the object as a syntax node (throwing an exception if it's not actually a syntax node).