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

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

Private functions

auto getChild(size_t index) -> TokenOrSyntax final
Gets the child (token or node) at the given index.
auto getChild(size_t index) const -> ConstTokenOrSyntax 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.
auto clone(BumpAllocator& alloc) const -> SyntaxListBase* 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).