#include <slang/syntax/SyntaxNode.h>
template<typename T>
SeparatedSyntaxList class
A container of token-separated syntax nodes.
The stored elements alternate between delimiters (such as a comma) and nodes.
Base classes
-
template<typename Derived, typename Element>class SyntaxListBase<SeparatedSyntaxList<T>, TokenOrSyntax>
- Common base for the three syntax-list container types.
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.
Constructors, destructors, conversion operators
-
template<std::ranges::contiguous_range R>SeparatedSyntaxList(BumpAllocator& alloc, const R& src)
- Constructs a separated list by copying the elements of src into storage allocated from alloc.
Public functions
- size_t getChildCount() const
- Number of items the list contributes to its parent's flattened child index space (includes interleaved separators).
- TokenOrSyntax getChild(size_t index)
- Gets the i-th item (token or node) from the underlying interleaved span.
- void setChild(size_t index, TokenOrSyntax child)
- Replaces the i-th item with child.
- SourceRange sourceRange() const
- Compute the SourceRange spanning all elements of this list.
- size_t size() const noexcept
- bool empty() const noexcept
Function documentation
template<typename T>
template<std::ranges::contiguous_range R>
slang:: syntax:: SeparatedSyntaxList<T>:: SeparatedSyntaxList(BumpAllocator& alloc,
const R& src)
Constructs a separated list by copying the elements of src into storage allocated from alloc.
The element type of the source range must be TokenOrSyntax.
template<typename T>
SourceRange slang:: syntax:: SeparatedSyntaxList<T>:: sourceRange() const
Compute the SourceRange spanning all elements of this list.
If empty, returns a default SourceRange.
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). |
|---|
template<typename T>
bool slang:: syntax:: SeparatedSyntaxList<T>:: empty() const noexcept
| Returns | true if the list is empty, false otherwise. |
|---|