template<typename T>
slang::syntax::SeparatedSyntaxList class

A syntax node that represents a token-separated list of child syntax nodes.

The stored children are assumed to alternate between delimiters (such as a comma) and nodes.

Base classes

class SyntaxListBase
A base class for syntax nodes that represent a list of items.

Public types

template<typename U>
class iterator_base
An iterator that will iterate over just the nodes (and skip the delimiters) in the parent SeparatedSyntaxList.

Public functions

std::span<const ConstTokenOrSyntax> elems() const
std::span<TokenOrSyntax> elems()
bool empty() const
size_t size() const noexcept

Private functions

TokenOrSyntax getChild(size_t index) final
Gets the child (token or node) at the given index.
ConstTokenOrSyntax getChild(size_t index) const final
Gets the child (token or node) at the given index.
void setChild(size_t index, TokenOrSyntax child) final
Sets the child (token or node) at the given index.
SyntaxListBase* clone(BumpAllocator& alloc) const final
Clones the list into a new node using the provided allocator.
void resetAll(BumpAllocator& alloc, std::span<const TokenOrSyntax> children) final
Overwrites all children with the new set of provided children (and making a copy with the provided allocator).

Function documentation

template<typename T>
std::span<const ConstTokenOrSyntax> slang::syntax::SeparatedSyntaxList<T>::elems() const

Returns the elements of nodes in the list

template<typename T>
std::span<TokenOrSyntax> slang::syntax::SeparatedSyntaxList<T>::elems()

Returns the elements of nodes in the list

template<typename T>
bool slang::syntax::SeparatedSyntaxList<T>::empty() const

Returns true if the list is empty, and false if it has elements.

template<typename T>
size_t slang::syntax::SeparatedSyntaxList<T>::size() const noexcept

Returns the number of nodes in the list (doesn't include delimiter tokens in the count).