Class SyntaxNodeWalk
Walks the syntax tree the way it is written, statements in the blocks of structured statements included.
public static class SyntaxNodeWalk
- Inheritance
-
SyntaxNodeWalk
- Inherited Members
Remarks
The Children of a node are the nodes it is made of, but not the statements of the blocks it guards: the body of an If, a loop, a
With or a Case is a StatementBlock that the statement holds on its own, and so are the ElseIf and Else branches of an
If and the Case branches of a Select Case. Walking Children alone therefore never gets inside any of them: a
declaration, or a statement, written in one is not found. This is where the tree is walked for whoever needs to see all of it.
Methods
ChildNodes(SyntaxNode)
The nodes node is directly made of: its Children, the branches of a structured statement, and the statements of
its own blocks.
public static IEnumerable<SyntaxNode> ChildNodes(this SyntaxNode node)
Parameters
nodeSyntaxNodeA node of the tree.
Returns
- IEnumerable<SyntaxNode>
The nodes, in the order they are written.
Descendants(SyntaxNode)
Every node under node, depth first and in the order they are written, however deep in the blocks of structured statements; not the node itself.
public static IEnumerable<SyntaxNode> Descendants(this SyntaxNode node)
Parameters
nodeSyntaxNodeA node of the tree.
Returns
SiblingLists(SyntaxNode)
The lists of sibling nodes that node holds: its Children, and the statements of each block it holds, each a list of
its own.
public static IEnumerable<IReadOnlyList<SyntaxNode>> SiblingLists(this SyntaxNode node)
Parameters
nodeSyntaxNodeA node of the tree.
Returns
Remarks
Whether one node follows another is a question about siblings: the statements of two blocks are not each other's, however they are written.