ShellSyntaxNode Class
The base of every node in a shell tree.
public abstract class ShellSyntaxNode : SyntaxNodeExample
var tree = ShellSyntaxTree.ParseText("ls -l", ShellDialect.Bash);
var kinds = new List<SyntaxKind>();
foreach (var node in tree.GetRoot().DescendantNodes())
{
kinds.Add(node.Kind());
}
Assert.Equal([SyntaxKind.StatementList, SyntaxKind.Command, SyntaxKind.Word, SyntaxKind.LiteralWordPart, SyntaxKind.Word, SyntaxKind.LiteralWordPart], kinds);- Inheritance
SyntaxNodeShellSyntaxNode
Properties
| Name | Description |
|---|---|
| Dialect | Gets the dialect the node was read as, or null when it belongs to no tree. |
| Parent | Gets the node this one is a child of, or null when it is the root of its tree. |
Dialect
ShellSyntaxNode.csGets the dialect the node was read as, or null when it belongs to no tree.
public ShellDialect? Dialect { get; }Property value
Parent
ShellSyntaxNode.csGets the node this one is a child of, or null when it is the root of its tree.
public ShellSyntaxNode? Parent { get; }Property value
Methods
| Name | Description |
|---|---|
| Accept(ShellSyntaxVisitor) | Calls the method of visitor that matches this node. |
| Accept<TResult>(ShellSyntaxVisitor<TResult>) | Calls the method of visitor that matches this node. |
| DescendantComments() | Returns every comment in this node, in source order. |
| Kind() | Gets what kind of node this is. |
Accept overloads
Accept(ShellSyntaxVisitor)
Calls the method of visitor that matches this node.
public abstract void Accept(ShellSyntaxVisitor visitor)Accept<TResult>(ShellSyntaxVisitor<TResult>)
Calls the method of visitor that matches this node.
public abstract TResult? Accept<TResult>(ShellSyntaxVisitor<TResult> visitor)Type parameters
TResult
Parameters
visitorShellSyntaxVisitor<TResult>
Returns
TResult?
Exceptions
ArgumentNullExceptionvisitorisnull.
DescendantComments()
ShellSyntaxNode.csReturns every comment in this node, in source order.
public IEnumerable<SyntaxTrivia> DescendantComments()