SyntaxList<TNode> Struct

A sequence of nodes of the same kind, held in one slot of their parent.

public readonly struct SyntaxList<TNode> : IEnumerable<TNode>, IReadOnlyCollection<TNode>, IReadOnlyList<TNode>, IEnumerable, IEquatable<SyntaxList<TNode>> where TNode : SyntaxNode

Type parameters

TNode
The type of the nodes in the list.

Remarks

default is the empty list.

Implements

Nested types

NameDescription
SyntaxList<TNode>.EnumeratorWalks a SyntaxList<TNode> without allocating.

Constructors

NameDescription
SyntaxList(IEnumerable<TNode>)Creates a detached list holding nodes.
SyntaxList(TNode?)Creates a detached list holding a single node.

SyntaxList overloads

SyntaxList(IEnumerable<TNode>)

SyntaxList.cs

Creates a detached list holding nodes.

public SyntaxList(IEnumerable<TNode> nodes)
Parameters
nodes IEnumerable<TNode>
Exceptions
ArgumentNullException
nodes is null.

SyntaxList(TNode?)

SyntaxList.cs

Creates a detached list holding a single node.

public SyntaxList(TNode? node)
Parameters
node TNode?

Properties

NameDescription
Count
FullSpan
Span
public int Count { get; }

Property value

int

No documentation is available.

public TextSpan FullSpan { get; }

Property value

TextSpan

No documentation is available.

public TextSpan Span { get; }

Property value

TextSpan

No documentation is available.

Indexers

NameDescription
this[int]

this[int]

SyntaxList.cs
public TNode this[int index] { get; }

Parameters

index int

Property value

TNode

No documentation is available.

Methods

NameDescription
Add(TNode)Returns a detached list with node appended.
AddRange(IEnumerable<TNode>)Returns a detached list with nodes appended.
Any()
Equals(SyntaxList<TNode>)
Equals(object?)
First()
FirstOrDefault()
GetEnumerator()
GetHashCode()
IndexOf(Func<TNode, bool>)Finds the first node matching predicate, or -1.
IndexOf(TNode)Returns the position of node in this list, or -1.
Insert(int, TNode)Returns a detached list with node inserted at index.
InsertRange(int, IEnumerable<TNode>)Returns a detached list with nodes inserted at index.
Last()
LastOrDefault()
Remove(TNode)Returns a detached list without node, or this list when it does not contain it.
RemoveAt(int)Returns a detached list without the node at index.
Replace(TNode, TNode)Returns a detached list with newNode in place of nodeInList.
ReplaceRange(TNode, IEnumerable<TNode>)Returns a detached list with newNodes in place of nodeInList.
System.Collections.Generic.IEnumerable<TNode>.GetEnumerator()
System.Collections.IEnumerable.GetEnumerator()
ToFullString()
ToString()

Add(TNode)

SyntaxList.cs

Returns a detached list with node appended.

public SyntaxList<TNode> Add(TNode node)

Parameters

node TNode

Returns

SyntaxList<TNode>

AddRange(IEnumerable<TNode>)

SyntaxList.cs

Returns a detached list with nodes appended.

public SyntaxList<TNode> AddRange(IEnumerable<TNode> nodes)
public bool Any()

Returns

bool

No documentation is available.

Equals overloads

Equals(SyntaxList<TNode>)

SyntaxList.cs
public bool Equals(SyntaxList<TNode> other)
Parameters
other SyntaxList<TNode>
Returns

bool

No documentation is available.

Equals(object?)

SyntaxList.cs
public override bool Equals(object? obj)
Parameters
obj object?
Returns

bool

No documentation is available.

public TNode? First()

Returns

TNode?

No documentation is available.

FirstOrDefault()

SyntaxList.cs
public TNode? FirstOrDefault()

Returns

TNode?

No documentation is available.

GetEnumerator()

SyntaxList.cs
public SyntaxList<TNode>.Enumerator GetEnumerator()

No documentation is available.

GetHashCode()

SyntaxList.cs
public override int GetHashCode()

Returns

int

No documentation is available.

IndexOf overloads

IndexOf(Func<TNode, bool>)

SyntaxList.cs

Finds the first node matching predicate, or -1.

public int IndexOf(Func<TNode, bool> predicate)
Parameters
predicate Func<TNode, bool>
Returns

int

Exceptions
ArgumentNullException
predicate is null.

IndexOf(TNode)

SyntaxList.cs

Returns the position of node in this list, or -1.

public int IndexOf(TNode node)
Parameters
node TNode
Returns

int

Remarks

Elements are matched by which one they are, not by the immutable node behind them: that node is shared, so two elements holding the same text are usually the same node and would both answer with the first position.

Insert(int, TNode)

SyntaxList.cs

Returns a detached list with node inserted at index.

public SyntaxList<TNode> Insert(int index, TNode node)

Parameters

index int
node TNode

Returns

SyntaxList<TNode>

Exceptions

ArgumentNullException
node is null.

InsertRange(int, IEnumerable<TNode>)

SyntaxList.cs

Returns a detached list with nodes inserted at index.

public SyntaxList<TNode> InsertRange(int index, IEnumerable<TNode> nodes)

Parameters

index int
nodes IEnumerable<TNode>

Returns

SyntaxList<TNode>

Exceptions

ArgumentNullException
nodes is null.
public TNode? Last()

Returns

TNode?

No documentation is available.

LastOrDefault()

SyntaxList.cs
public TNode? LastOrDefault()

Returns

TNode?

No documentation is available.

Remove(TNode)

SyntaxList.cs

Returns a detached list without node, or this list when it does not contain it.

public SyntaxList<TNode> Remove(TNode node)

Parameters

node TNode

Returns

SyntaxList<TNode>

RemoveAt(int)

SyntaxList.cs

Returns a detached list without the node at index.

public SyntaxList<TNode> RemoveAt(int index)

Parameters

index int

Returns

SyntaxList<TNode>

Replace(TNode, TNode)

SyntaxList.cs

Returns a detached list with newNode in place of nodeInList.

public SyntaxList<TNode> Replace(TNode nodeInList, TNode newNode)

Parameters

nodeInList TNode
newNode TNode

Returns

SyntaxList<TNode>

Exceptions

ArgumentNullException
newNode is null.
ArgumentException
nodeInList is not in this list.

ReplaceRange(TNode, IEnumerable<TNode>)

SyntaxList.cs

Returns a detached list with newNodes in place of nodeInList.

public SyntaxList<TNode> ReplaceRange(TNode nodeInList, IEnumerable<TNode> newNodes)

Parameters

nodeInList TNode
newNodes IEnumerable<TNode>

Returns

SyntaxList<TNode>

Exceptions

ArgumentNullException
newNodes is null.
ArgumentException
nodeInList is not in this list.

System.Collections.Generic.IEnumerable<TNode>.GetEnumerator()

SyntaxList.cs
IEnumerator<TNode> IEnumerable<TNode>.GetEnumerator()

No documentation is available.

System.Collections.IEnumerable.GetEnumerator()

SyntaxList.cs
IEnumerator IEnumerable.GetEnumerator()

No documentation is available.

ToFullString()

SyntaxList.cs
public string ToFullString()

Returns

string

No documentation is available.

ToString()

SyntaxList.cs
public override string ToString()

Returns

string

No documentation is available.

Operators

NameDescription
operator ==(SyntaxList<TNode>, SyntaxList<TNode>)
implicit operator SyntaxList<SyntaxNode>(SyntaxList<TNode>)
operator !=(SyntaxList<TNode>, SyntaxList<TNode>)

operator ==(SyntaxList<TNode>, SyntaxList<TNode>)

SyntaxList.cs
public static bool operator ==(SyntaxList<TNode> left, SyntaxList<TNode> right)

Parameters

left SyntaxList<TNode>
right SyntaxList<TNode>

Returns

bool

No documentation is available.

implicit operator SyntaxList<SyntaxNode>(SyntaxList<TNode>)

SyntaxList.cs
public static implicit operator SyntaxList<SyntaxNode>(SyntaxList<TNode> nodes)

No documentation is available.

operator !=(SyntaxList<TNode>, SyntaxList<TNode>)

SyntaxList.cs
public static bool operator !=(SyntaxList<TNode> left, SyntaxList<TNode> right)

Parameters

left SyntaxList<TNode>
right SyntaxList<TNode>

Returns

bool

No documentation is available.