Class SyntaxNode
Represents a non-terminal node in the syntax tree.
Inheritance
System.Object
SyntaxNode
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Loretta.CodeAnalysis.dll
Syntax
public abstract class SyntaxNode
Properties
|
Improve this Doc
View Source
ContainsAnnotations
Determines whether this node or any sub node, token or trivia has annotations.
Declaration
public bool ContainsAnnotations { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
ContainsDiagnostics
Determines whether this node or any of its descendant nodes, tokens or trivia have any diagnostics on them.
Declaration
public bool ContainsDiagnostics { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
ContainsDirectives
Determines whether this node has any descendant preprocessor directives.
Declaration
public bool ContainsDirectives { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
ContainsSkippedText
Determines whether this node has any descendant skipped text.
Declaration
public bool ContainsSkippedText { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
FullSpan
The absolute span of this node in characters, including its leading and trailing trivia.
Declaration
public TextSpan FullSpan { get; }
Property Value
|
Improve this Doc
View Source
HasLeadingTrivia
Determines whether this node has any leading trivia.
Declaration
public bool HasLeadingTrivia { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
HasStructuredTrivia
Determines whether a descendant trivia of this node is structured.
Declaration
public bool HasStructuredTrivia { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
HasTrailingTrivia
Determines whether this node has any trailing trivia.
Declaration
public bool HasTrailingTrivia { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsMissing
Determines whether the node represents a language construct that was actually parsed
from the source code. Missing nodes are generated by the parser in error scenarios to
represent constructs that should have been present in the source code in order to
compile successfully but were actually missing.
Declaration
public bool IsMissing { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsStructuredTrivia
Determines whether this node represents a structured trivia.
Declaration
public bool IsStructuredTrivia { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Language
The language name that this node is syntax of.
Declaration
public abstract string Language { get; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Parent
The node that contains this node in its ChildNodes() collection.
Declaration
public SyntaxNode Parent { get; }
Property Value
|
Improve this Doc
View Source
ParentTrivia
The parent trivia for this node in case it is part of structured trivia.
Declaration
public virtual SyntaxTrivia ParentTrivia { get; }
Property Value
|
Improve this Doc
View Source
RawKind
An integer representing the language specific kind of this node.
Declaration
public int RawKind { get; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Span
The absolute span of this node in characters, not including its leading and trailing trivia.
Declaration
public TextSpan Span { get; }
Property Value
|
Improve this Doc
View Source
SpanStart
Declaration
public int SpanStart { get; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
SyntaxTree
Returns SyntaxTree that owns the node or null if node does not belong to a
SyntaxTree
Declaration
public SyntaxTree SyntaxTree { get; }
Property Value
Methods
|
Improve this Doc
View Source
Ancestors(Boolean)
Gets a list of ancestor nodes
Declaration
public IEnumerable<SyntaxNode> Ancestors(bool ascendOutOfTrivia = true)
Parameters
Type |
Name |
Description |
System.Boolean |
ascendOutOfTrivia |
|
Returns
|
Improve this Doc
View Source
AncestorsAndSelf(Boolean)
Gets a list of ancestor nodes (including this node)
Declaration
public IEnumerable<SyntaxNode> AncestorsAndSelf(bool ascendOutOfTrivia = true)
Parameters
Type |
Name |
Description |
System.Boolean |
ascendOutOfTrivia |
|
Returns
|
Improve this Doc
View Source
ChildNodes()
Gets a list of the child nodes in prefix document order.
Declaration
public IEnumerable<SyntaxNode> ChildNodes()
Returns
|
Improve this Doc
View Source
ChildNodesAndTokens()
The list of child nodes and tokens of this node, where each element is a SyntaxNodeOrToken instance.
Declaration
public ChildSyntaxList ChildNodesAndTokens()
Returns
|
Improve this Doc
View Source
ChildThatContainsPosition(Int32)
Returns the child node or token that contains the provided position.
Declaration
public virtual SyntaxNodeOrToken ChildThatContainsPosition(int position)
Parameters
Type |
Name |
Description |
System.Int32 |
position |
|
Returns
|
Improve this Doc
View Source
ChildTokens()
Gets a list of the direct child tokens of this node.
Declaration
public IEnumerable<SyntaxToken> ChildTokens()
Returns
|
Improve this Doc
View Source
Contains(SyntaxNode)
Determines if the specified node is a descendant of this node.
Returns true for current node.
Declaration
public bool Contains(SyntaxNode node)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
CopyAnnotationsTo<T>(T)
Copies all SyntaxAnnotations, if any, from this SyntaxNode instance and attaches them to a new instance based on node
.
Declaration
public T CopyAnnotationsTo<T>(T node)
where T : SyntaxNode
Parameters
Type |
Name |
Description |
T |
node |
|
Returns
Type Parameters
|
Improve this Doc
View Source
DescendantNodes(TextSpan, Nullable<Func<SyntaxNode, Boolean>>, Boolean)
Gets a list of descendant nodes in prefix document order.
Declaration
public IEnumerable<SyntaxNode> DescendantNodes(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
Parameters
Type |
Name |
Description |
TextSpan |
span |
The span the node's full span must intersect.
|
System.Nullable<Func<SyntaxNode, System.Boolean>> |
descendIntoChildren |
An optional function that determines if the search descends into the argument node's children.
|
System.Boolean |
descendIntoTrivia |
Determines if nodes that are part of structured trivia are included in the list.
|
Returns
|
Improve this Doc
View Source
DescendantNodes(Nullable<Func<SyntaxNode, Boolean>>, Boolean)
Gets a list of descendant nodes in prefix document order.
Declaration
public IEnumerable<SyntaxNode> DescendantNodes(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
Parameters
Type |
Name |
Description |
System.Nullable<Func<SyntaxNode, System.Boolean>> |
descendIntoChildren |
An optional function that determines if the search descends into the argument node's children.
|
System.Boolean |
descendIntoTrivia |
Determines if nodes that are part of structured trivia are included in the list.
|
Returns
|
Improve this Doc
View Source
DescendantNodesAndSelf(TextSpan, Nullable<Func<SyntaxNode, Boolean>>, Boolean)
Gets a list of descendant nodes (including this node) in prefix document order.
Declaration
public IEnumerable<SyntaxNode> DescendantNodesAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
Parameters
Type |
Name |
Description |
TextSpan |
span |
The span the node's full span must intersect.
|
System.Nullable<Func<SyntaxNode, System.Boolean>> |
descendIntoChildren |
An optional function that determines if the search descends into the argument node's children.
|
System.Boolean |
descendIntoTrivia |
Determines if nodes that are part of structured trivia are included in the list.
|
Returns
|
Improve this Doc
View Source
DescendantNodesAndSelf(Nullable<Func<SyntaxNode, Boolean>>, Boolean)
Gets a list of descendant nodes (including this node) in prefix document order.
Declaration
public IEnumerable<SyntaxNode> DescendantNodesAndSelf(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
Parameters
Type |
Name |
Description |
System.Nullable<Func<SyntaxNode, System.Boolean>> |
descendIntoChildren |
An optional function that determines if the search descends into the argument node's children.
|
System.Boolean |
descendIntoTrivia |
Determines if nodes that are part of structured trivia are included in the list.
|
Returns
|
Improve this Doc
View Source
DescendantNodesAndTokens(TextSpan, Nullable<Func<SyntaxNode, Boolean>>, Boolean)
Gets a list of the descendant nodes and tokens in prefix document order.
Declaration
public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
Parameters
Type |
Name |
Description |
TextSpan |
span |
The span the node's full span must intersect.
|
System.Nullable<Func<SyntaxNode, System.Boolean>> |
descendIntoChildren |
An optional function that determines if the search descends into the argument node's children.
|
System.Boolean |
descendIntoTrivia |
Determines if nodes that are part of structured trivia are included in the list.
|
Returns
|
Improve this Doc
View Source
DescendantNodesAndTokens(Nullable<Func<SyntaxNode, Boolean>>, Boolean)
Gets a list of descendant nodes and tokens in prefix document order.
Declaration
public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
Parameters
Type |
Name |
Description |
System.Nullable<Func<SyntaxNode, System.Boolean>> |
descendIntoChildren |
An optional function that determines if the search descends into the argument node's children.
|
System.Boolean |
descendIntoTrivia |
Determines if nodes that are part of structured trivia are included in the list.
|
Returns
|
Improve this Doc
View Source
DescendantNodesAndTokensAndSelf(TextSpan, Nullable<Func<SyntaxNode, Boolean>>, Boolean)
Gets a list of the descendant nodes and tokens (including this node) in prefix document order.
Declaration
public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
Parameters
Type |
Name |
Description |
TextSpan |
span |
The span the node's full span must intersect.
|
System.Nullable<Func<SyntaxNode, System.Boolean>> |
descendIntoChildren |
An optional function that determines if the search descends into the argument node's children.
|
System.Boolean |
descendIntoTrivia |
Determines if nodes that are part of structured trivia are included in the list.
|
Returns
|
Improve this Doc
View Source
DescendantNodesAndTokensAndSelf(Nullable<Func<SyntaxNode, Boolean>>, Boolean)
Gets a list of descendant nodes and tokens (including this node) in prefix document order.
Declaration
public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
Parameters
Type |
Name |
Description |
System.Nullable<Func<SyntaxNode, System.Boolean>> |
descendIntoChildren |
An optional function that determines if the search descends into the argument node's children.
|
System.Boolean |
descendIntoTrivia |
Determines if nodes that are part of structured trivia are included in the list.
|
Returns
|
Improve this Doc
View Source
DescendantTokens(TextSpan, Nullable<Func<SyntaxNode, Boolean>>, Boolean)
Gets a list of all the tokens in the full span of this node.
Declaration
public IEnumerable<SyntaxToken> DescendantTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
Parameters
Type |
Name |
Description |
TextSpan |
span |
|
System.Nullable<Func<SyntaxNode, System.Boolean>> |
descendIntoChildren |
|
System.Boolean |
descendIntoTrivia |
|
Returns
|
Improve this Doc
View Source
DescendantTokens(Nullable<Func<SyntaxNode, Boolean>>, Boolean)
Gets a list of all the tokens in the span of this node.
Declaration
public IEnumerable<SyntaxToken> DescendantTokens(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
Parameters
Type |
Name |
Description |
System.Nullable<Func<SyntaxNode, System.Boolean>> |
descendIntoChildren |
|
System.Boolean |
descendIntoTrivia |
|
Returns
|
Improve this Doc
View Source
DescendantTrivia(TextSpan, Nullable<Func<SyntaxNode, Boolean>>, Boolean)
Get a list of all the trivia associated with the descendant nodes and tokens.
Declaration
public IEnumerable<SyntaxTrivia> DescendantTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
Parameters
Type |
Name |
Description |
TextSpan |
span |
|
System.Nullable<Func<SyntaxNode, System.Boolean>> |
descendIntoChildren |
|
System.Boolean |
descendIntoTrivia |
|
Returns
|
Improve this Doc
View Source
DescendantTrivia(Nullable<Func<SyntaxNode, Boolean>>, Boolean)
Get a list of all the trivia associated with the descendant nodes and tokens.
Declaration
public IEnumerable<SyntaxTrivia> DescendantTrivia(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
Parameters
Type |
Name |
Description |
System.Nullable<Func<SyntaxNode, System.Boolean>> |
descendIntoChildren |
|
System.Boolean |
descendIntoTrivia |
|
Returns
|
Improve this Doc
View Source
FindNode(TextSpan, Boolean, Boolean)
Finds the node with the smallest FullSpan that contains span
.
getInnermostNodeForTie
is used to determine the behavior in case of a tie (i.e. a node having the same span as its parent).
If getInnermostNodeForTie
is true, then it returns lowest descending node encompassing the given span
.
Otherwise, it returns the outermost node encompassing the given span
.
Declaration
public SyntaxNode FindNode(TextSpan span, bool findInsideTrivia = false, bool getInnermostNodeForTie = false)
Parameters
Type |
Name |
Description |
TextSpan |
span |
|
System.Boolean |
findInsideTrivia |
|
System.Boolean |
getInnermostNodeForTie |
|
Returns
|
Improve this Doc
View Source
FindToken(Int32, Boolean)
Finds a descendant token of this node whose span includes the supplied position.
Declaration
public SyntaxToken FindToken(int position, bool findInsideTrivia = false)
Parameters
Type |
Name |
Description |
System.Int32 |
position |
The character position of the token relative to the beginning of the file.
|
System.Boolean |
findInsideTrivia |
True to return tokens that are part of trivia. If false finds the token whose full span (including trivia)
includes the position.
|
Returns
|
Improve this Doc
View Source
FindTrivia(Int32, Boolean)
Finds a descendant trivia of this node whose span includes the supplied position.
Declaration
public SyntaxTrivia FindTrivia(int position, bool findInsideTrivia = false)
Parameters
Type |
Name |
Description |
System.Int32 |
position |
The character position of the trivia relative to the beginning of the file.
|
System.Boolean |
findInsideTrivia |
True to return tokens that are part of trivia. If false finds the token whose full span (including trivia)
includes the position.
|
Returns
|
Improve this Doc
View Source
FindTrivia(Int32, Nullable<Func<SyntaxTrivia, Boolean>>)
Finds a descendant trivia of this node at the specified position, where the position is
within the span of the node.
Declaration
public SyntaxTrivia FindTrivia(int position, Func<SyntaxTrivia, bool>? stepInto)
Parameters
Type |
Name |
Description |
System.Int32 |
position |
The character position of the trivia relative to the beginning of
the file.
|
System.Nullable<Func<SyntaxTrivia, System.Boolean>> |
stepInto |
Specifies a function that determines per trivia node, whether to
descend into structured trivia of that node.
|
Returns
|
Improve this Doc
View Source
FirstAncestorOrSelf<TNode>(Nullable<Func<TNode, Boolean>>, Boolean)
Gets the first node of type TNode that matches the predicate.
Declaration
public TNode FirstAncestorOrSelf<TNode>(Func<TNode, bool>? predicate = null, bool ascendOutOfTrivia = true)
where TNode : SyntaxNode
Parameters
Type |
Name |
Description |
System.Nullable<Func<TNode, System.Boolean>> |
predicate |
|
System.Boolean |
ascendOutOfTrivia |
|
Returns
Type Parameters
|
Improve this Doc
View Source
FirstAncestorOrSelf<TNode, TArg>(Func<TNode, TArg, Boolean>, TArg, Boolean)
Gets the first node of type TNode that matches the predicate.
Declaration
public TNode FirstAncestorOrSelf<TNode, TArg>(Func<TNode, TArg, bool> predicate, TArg argument, bool ascendOutOfTrivia = true)
where TNode : SyntaxNode
Parameters
Type |
Name |
Description |
Func<TNode, TArg, System.Boolean> |
predicate |
|
TArg |
argument |
|
System.Boolean |
ascendOutOfTrivia |
|
Returns
Type Parameters
Name |
Description |
TNode |
|
TArg |
|
|
Improve this Doc
View Source
GetAnnotatedNodes(SyntaxAnnotation)
Gets all nodes with the specified annotation.
Declaration
public IEnumerable<SyntaxNode> GetAnnotatedNodes(SyntaxAnnotation syntaxAnnotation)
Parameters
Returns
|
Improve this Doc
View Source
GetAnnotatedNodes(String)
Gets all nodes with the specified annotation kind.
Declaration
public IEnumerable<SyntaxNode> GetAnnotatedNodes(string annotationKind)
Parameters
Type |
Name |
Description |
System.String |
annotationKind |
|
Returns
|
Improve this Doc
View Source
GetAnnotatedNodesAndTokens(SyntaxAnnotation)
Gets all nodes and tokens with the specified annotation.
Declaration
public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(SyntaxAnnotation annotation)
Parameters
Returns
|
Improve this Doc
View Source
GetAnnotatedNodesAndTokens(String)
Gets all nodes and tokens with an annotation of the specified annotation kind.
Declaration
public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(string annotationKind)
Parameters
Type |
Name |
Description |
System.String |
annotationKind |
|
Returns
|
Improve this Doc
View Source
GetAnnotatedNodesAndTokens(String[])
Gets all nodes and tokens with an annotation of the specified annotation kinds.
Declaration
public IEnumerable<SyntaxNodeOrToken> GetAnnotatedNodesAndTokens(params string[] annotationKinds)
Parameters
Type |
Name |
Description |
System.String[] |
annotationKinds |
|
Returns
|
Improve this Doc
View Source
GetAnnotatedTokens(SyntaxAnnotation)
Gets all tokens with the specified annotation.
Declaration
public IEnumerable<SyntaxToken> GetAnnotatedTokens(SyntaxAnnotation syntaxAnnotation)
Parameters
Returns
|
Improve this Doc
View Source
GetAnnotatedTokens(String)
Gets all tokens with the specified annotation kind.
Declaration
public IEnumerable<SyntaxToken> GetAnnotatedTokens(string annotationKind)
Parameters
Type |
Name |
Description |
System.String |
annotationKind |
|
Returns
|
Improve this Doc
View Source
GetAnnotatedTrivia(SyntaxAnnotation)
Gets all trivia with the specified annotation.
Declaration
public IEnumerable<SyntaxTrivia> GetAnnotatedTrivia(SyntaxAnnotation annotation)
Parameters
Returns
|
Improve this Doc
View Source
GetAnnotatedTrivia(String)
Gets all trivia with an annotation of the specified annotation kind.
Declaration
public IEnumerable<SyntaxTrivia> GetAnnotatedTrivia(string annotationKind)
Parameters
Type |
Name |
Description |
System.String |
annotationKind |
|
Returns
|
Improve this Doc
View Source
GetAnnotatedTrivia(String[])
Gets all trivia with an annotation of the specified annotation kinds.
Declaration
public IEnumerable<SyntaxTrivia> GetAnnotatedTrivia(params string[] annotationKinds)
Parameters
Type |
Name |
Description |
System.String[] |
annotationKinds |
|
Returns
|
Improve this Doc
View Source
GetAnnotations(IEnumerable<String>)
Gets all the annotations with the specified annotation kinds.
Declaration
public IEnumerable<SyntaxAnnotation> GetAnnotations(IEnumerable<string> annotationKinds)
Parameters
Type |
Name |
Description |
IEnumerable<System.String> |
annotationKinds |
|
Returns
|
Improve this Doc
View Source
GetAnnotations(String)
Gets all the annotations with the specified annotation kind.
Declaration
public IEnumerable<SyntaxAnnotation> GetAnnotations(string annotationKind)
Parameters
Type |
Name |
Description |
System.String |
annotationKind |
|
Returns
|
Improve this Doc
View Source
GetDiagnostics()
Gets a list of all the diagnostics in the sub tree that has this node as its root.
This method does not filter diagnostics based on #pragmas and compiler options
like nowarn, warnaserror etc.
Declaration
public IEnumerable<Diagnostic> GetDiagnostics()
Returns
|
Improve this Doc
View Source
GetFirstToken(Boolean, Boolean, Boolean, Boolean)
Gets the first token of the tree rooted by this node. Skips zero-width tokens.
Declaration
public SyntaxToken GetFirstToken(bool includeZeroWidth = false, bool includeSkipped = false, bool includeDirectives = false, bool includeDocumentationComments = false)
Parameters
Type |
Name |
Description |
System.Boolean |
includeZeroWidth |
|
System.Boolean |
includeSkipped |
|
System.Boolean |
includeDirectives |
|
System.Boolean |
includeDocumentationComments |
|
Returns
Type |
Description |
SyntaxToken |
The first token or default(SyntaxToken) if it doesn't exist.
|
|
Improve this Doc
View Source
GetLastToken(Boolean, Boolean, Boolean, Boolean)
Gets the last token of the tree rooted by this node. Skips zero-width tokens.
Declaration
public SyntaxToken GetLastToken(bool includeZeroWidth = false, bool includeSkipped = false, bool includeDirectives = false, bool includeDocumentationComments = false)
Parameters
Type |
Name |
Description |
System.Boolean |
includeZeroWidth |
|
System.Boolean |
includeSkipped |
|
System.Boolean |
includeDirectives |
|
System.Boolean |
includeDocumentationComments |
|
Returns
Type |
Description |
SyntaxToken |
The last token or default(SyntaxToken) if it doesn't exist.
|
|
Improve this Doc
View Source
GetLeadingTrivia()
The list of trivia that appears before this node in the source code and are attached to a token that is a
descendant of this node.
Declaration
public SyntaxTriviaList GetLeadingTrivia()
Returns
|
Improve this Doc
View Source
GetLocation()
Declaration
public Location GetLocation()
Returns
|
Improve this Doc
View Source
GetReference()
Gets a SyntaxReference for this syntax node. CommonSyntaxReferences can be used to
regain access to a syntax node without keeping the entire tree and source text in
memory.
Declaration
public SyntaxReference GetReference()
Returns
|
Improve this Doc
View Source
GetText(Encoding, SourceHashAlgorithm)
Gets the full text of this node as a new SourceText instance.
Declaration
public SourceText GetText(Encoding encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1)
Parameters
Type |
Name |
Description |
System.Text.Encoding |
encoding |
Encoding of the file that the text was read from or is going to be saved to.
null if the encoding is unspecified.
If the encoding is not specified the SourceText isn't debuggable.
If an encoding-less SourceText is written to a file a System.Text.Encoding.UTF8 shall be used as a default.
|
SourceHashAlgorithm |
checksumAlgorithm |
Hash algorithm to use to calculate checksum of the text that's saved to PDB.
|
Returns
|
Improve this Doc
View Source
GetTrailingTrivia()
The list of trivia that appears after this node in the source code and are attached to a token that is a
descendant of this node.
Declaration
public SyntaxTriviaList GetTrailingTrivia()
Returns
|
Improve this Doc
View Source
HasAnnotation(SyntaxAnnotation)
Determines whether this node has the specific annotation.
Declaration
public bool HasAnnotation(SyntaxAnnotation annotation)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
HasAnnotations(IEnumerable<String>)
Determines whether this node has any annotations with any of the specific annotation kinds.
Declaration
public bool HasAnnotations(IEnumerable<string> annotationKinds)
Parameters
Type |
Name |
Description |
IEnumerable<System.String> |
annotationKinds |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
HasAnnotations(String)
Determines whether this node has any annotations with the specific annotation kind.
Declaration
public bool HasAnnotations(string annotationKind)
Parameters
Type |
Name |
Description |
System.String |
annotationKind |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsEquivalentTo(SyntaxNode)
Determine whether this node is structurally equivalent to another.
Declaration
public bool IsEquivalentTo(SyntaxNode other)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsEquivalentTo(SyntaxNode, Boolean)
Determines if two nodes are the same, disregarding trivia differences.
Declaration
public bool IsEquivalentTo(SyntaxNode node, bool topLevel = false)
Parameters
Type |
Name |
Description |
SyntaxNode |
node |
The node to compare against.
|
System.Boolean |
topLevel |
If true then the nodes are equivalent if the contained nodes and
tokens declaring metadata visible symbolic information are equivalent, ignoring any
differences of nodes inside method bodies or initializer expressions, otherwise all
nodes and tokens must be equivalent.
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsIncrementallyIdenticalTo(SyntaxNode)
Returns true if these two nodes are considered "incrementally identical". An incrementally identical node
occurs when a SyntaxTree is incrementally parsed using WithChangedText(SourceText)
and the incremental parser is able to take the node from the original tree and use it in its entirety in the
new tree. In this case, the ToFullString() of each node will be the same, though
they could have different parents, and may occur at different positions in their respective trees. If two nodes are
incrementally identical, all children of each node will be incrementally identical as well.
Declaration
public bool IsIncrementallyIdenticalTo(SyntaxNode other)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsPartOfStructuredTrivia()
Determines whether this node is a descendant of a structured trivia.
Declaration
public bool IsPartOfStructuredTrivia()
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
SerializeTo(Stream, CancellationToken)
Serializes the node to the given stream
.
Leaves the stream
open for further writes.
Declaration
public virtual void SerializeTo(Stream stream, CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
Stream |
stream |
|
CancellationToken |
cancellationToken |
|
|
Improve this Doc
View Source
ToFullString()
Returns full string representation of this node including its leading and trailing trivia.
Declaration
public virtual string ToFullString()
Returns
Type |
Description |
System.String |
The full string representation of this node including its leading and trailing trivia.
|
|
Improve this Doc
View Source
ToString()
Returns the string representation of this node, not including its leading and trailing trivia.
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
The string representation of this node, not including its leading and trailing trivia.
|
Overrides
System.Object.ToString()
|
Improve this Doc
View Source
WriteTo(TextWriter)
Writes the full text of this node to the specified .
Declaration
public virtual void WriteTo(TextWriter writer)
Parameters
Type |
Name |
Description |
TextWriter |
writer |
|
Extension Methods
SyntaxNodeExtensions.ReplaceSyntax<TRoot>(TRoot, IEnumerable<SyntaxNode>, Func<SyntaxNode, SyntaxNode, SyntaxNode>, IEnumerable<SyntaxToken>, Func<SyntaxToken, SyntaxToken, SyntaxToken>, IEnumerable<SyntaxTrivia>, Func<SyntaxTrivia, SyntaxTrivia, SyntaxTrivia>)