Struct SyntaxNodeOrToken
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
Assembly: cs.temp.dll.dll
Syntax
public readonly struct SyntaxNodeOrToken
Properties
ContainsAnnotations
Determines whether this node or token (or any sub node, token or trivia) as annotations.
Declaration
public readonly bool ContainsAnnotations { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
ContainsDiagnostics
Determines whether the underlying node or token or any of its descendant nodes, tokens or trivia have any
diagnostics on them.
Declaration
public readonly bool ContainsDiagnostics { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
ContainsDirectives
Determines whether the underlying node or token has any descendant preprocessor directives.
Declaration
public readonly bool ContainsDirectives { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
FullSpan
The absolute span of the underlying node or token in characters, including its leading and trailing trivia.
Declaration
public readonly TextSpan FullSpan { get; }
Property Value
| Type |
Description |
| TextSpan |
|
HasLeadingTrivia
Determines whether the underlying node or token has any leading trivia.
Declaration
public readonly bool HasLeadingTrivia { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
HasTrailingTrivia
Determines whether the underlying node or token has any trailing trivia.
Declaration
public readonly bool HasTrailingTrivia { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsMissing
Determines whether the underlying node or token represents a language construct that was actually parsed
from source code. Missing nodes and tokens are typically generated by the parser in error scenarios to
represent constructs that should have been present in the source code for the source code to compile
successfully but were actually missing.
Declaration
public readonly bool IsMissing { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsNode
Declaration
public readonly bool IsNode { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsToken
Declaration
public readonly bool IsToken { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
Language
The language name that this node or token is syntax of.
Declaration
public readonly string Language { get; }
Property Value
| Type |
Description |
| System.String |
|
Parent
The node that contains the underlying node or token in its Children collection.
Declaration
public readonly SyntaxNode Parent { get; }
Property Value
RawKind
An integer representing the language specific kind of the underlying node or token.
Declaration
public readonly int RawKind { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
Span
The absolute span of the underlying node or token in characters, not including its leading and trailing
trivia.
Declaration
public readonly TextSpan Span { get; }
Property Value
| Type |
Description |
| TextSpan |
|
SpanStart
Same as accessing on Span.
Declaration
public readonly int SpanStart { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
SyntaxTree
SyntaxTree which contains current SyntaxNodeOrToken.
Declaration
public readonly SyntaxTree SyntaxTree { get; }
Property Value
Methods
AsNode()
Declaration
public readonly SyntaxNode AsNode()
Returns
AsToken()
Declaration
public readonly SyntaxToken AsToken()
Returns
ChildNodesAndTokens()
The list of child nodes and tokens of the underlying node or token.
Declaration
public readonly ChildSyntaxList ChildNodesAndTokens()
Returns
Equals(SyntaxNodeOrToken)
Declaration
public readonly bool Equals(SyntaxNodeOrToken other)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Equals(Object)
Declaration
public override readonly bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
|
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
System.ValueType.Equals(System.Object)
GetAnnotations(IEnumerable<String>)
Gets all annotations of the specified annotation kind.
Declaration
public readonly IEnumerable<SyntaxAnnotation> GetAnnotations(IEnumerable<string> annotationKinds)
Parameters
| Type |
Name |
Description |
| IEnumerable<System.String> |
annotationKinds |
|
Returns
GetAnnotations(String)
Gets all annotations of the specified annotation kind.
Declaration
public readonly IEnumerable<SyntaxAnnotation> GetAnnotations(string annotationKind)
Parameters
| Type |
Name |
Description |
| System.String |
annotationKind |
|
Returns
GetDiagnostics()
Gets a list of all the diagnostics in either the sub tree that has this node as its root or
associated with this token and its related trivia.
This method does not filter diagnostics based on #pragmas and compiler options
like nowarn, warnaserror etc.
Declaration
public readonly IEnumerable<Diagnostic> GetDiagnostics()
Returns
GetFirstChildIndexSpanningPosition(SyntaxNode, Int32)
Returns the index of the first child of the provided node that contains the provided position.
Declaration
public static int GetFirstChildIndexSpanningPosition(SyntaxNode node, int position)
Parameters
| Type |
Name |
Description |
| SyntaxNode |
node |
|
| System.Int32 |
position |
|
Returns
| Type |
Description |
| System.Int32 |
|
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
| Type |
Description |
| System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
GetLeadingTrivia()
The list of trivia that appear before the underlying node or token in the source code and are attached to a
token that is a descendant of the underlying node or token.
Declaration
public readonly SyntaxTriviaList GetLeadingTrivia()
Returns
GetLocation()
Get the location of this node or token.
Declaration
public readonly Location GetLocation()
Returns
GetNextSibling()
Returns the sibling to the right of this node or token.
Declaration
public readonly SyntaxNodeOrToken GetNextSibling()
Returns
GetPreviousSibling()
Returns the sibling to the left of this node or token.
Declaration
public readonly SyntaxNodeOrToken GetPreviousSibling()
Returns
GetTrailingTrivia()
The list of trivia that appear after the underlying node or token in the source code and are attached to a
token that is a descendant of the underlying node or token.
Declaration
public readonly SyntaxTriviaList GetTrailingTrivia()
Returns
HasAnnotation(SyntaxAnnotation)
Determines if this node or token has the specific annotation.
Declaration
public readonly bool HasAnnotation(SyntaxAnnotation annotation)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
HasAnnotations(IEnumerable<String>)
Determines whether this node or token has annotations of the specified kind.
Declaration
public readonly bool HasAnnotations(IEnumerable<string> annotationKinds)
Parameters
| Type |
Name |
Description |
| IEnumerable<System.String> |
annotationKinds |
|
Returns
| Type |
Description |
| System.Boolean |
|
HasAnnotations(String)
Determines whether this node or token has annotations of the specified kind.
Declaration
public readonly bool HasAnnotations(string annotationKind)
Parameters
| Type |
Name |
Description |
| System.String |
annotationKind |
|
Returns
| Type |
Description |
| System.Boolean |
|
IsEquivalentTo(SyntaxNodeOrToken)
Determines if the two nodes or tokens are equivalent.
Declaration
public readonly bool IsEquivalentTo(SyntaxNodeOrToken other)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
IsIncrementallyIdenticalTo(SyntaxNodeOrToken)
Declaration
public readonly bool IsIncrementallyIdenticalTo(SyntaxNodeOrToken other)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
ToFullString()
Returns the full string representation of this node or token including its leading and trailing trivia.
Declaration
public readonly string ToFullString()
Returns
| Type |
Description |
| System.String |
The full string representation of this node or token including its leading and trailing
trivia.
|
ToString()
Returns the string representation of this node or token, not including its leading and trailing
trivia.
Declaration
public override readonly string ToString()
Returns
| Type |
Description |
| System.String |
The string representation of this node or token, not including its leading and trailing trivia.
|
Overrides
System.ValueType.ToString()
WithAdditionalAnnotations(IEnumerable<SyntaxAnnotation>)
Creates a new node or token identical to this one with the specified annotations.
Declaration
public readonly SyntaxNodeOrToken WithAdditionalAnnotations(IEnumerable<SyntaxAnnotation> annotations)
Parameters
Returns
WithAdditionalAnnotations(SyntaxAnnotation[])
Creates a new node or token identical to this one with the specified annotations.
Declaration
public readonly SyntaxNodeOrToken WithAdditionalAnnotations(params SyntaxAnnotation[] annotations)
Parameters
Returns
WithLeadingTrivia(IEnumerable<SyntaxTrivia>)
Declaration
public readonly SyntaxNodeOrToken WithLeadingTrivia(IEnumerable<SyntaxTrivia> trivia)
Parameters
Returns
WithLeadingTrivia(SyntaxTrivia[])
Declaration
public readonly SyntaxNodeOrToken WithLeadingTrivia(params SyntaxTrivia[] trivia)
Parameters
Returns
WithoutAnnotations(IEnumerable<SyntaxAnnotation>)
Creates a new node or token identical to this one without the specified annotations.
Declaration
public readonly SyntaxNodeOrToken WithoutAnnotations(IEnumerable<SyntaxAnnotation> annotations)
Parameters
Returns
WithoutAnnotations(SyntaxAnnotation[])
Creates a new node or token identical to this one without the specified annotations.
Declaration
public readonly SyntaxNodeOrToken WithoutAnnotations(params SyntaxAnnotation[] annotations)
Parameters
Returns
WithoutAnnotations(String)
Creates a new node or token identical to this one without annotations of the specified kind.
Declaration
public readonly SyntaxNodeOrToken WithoutAnnotations(string annotationKind)
Parameters
| Type |
Name |
Description |
| System.String |
annotationKind |
|
Returns
WithTrailingTrivia(IEnumerable<SyntaxTrivia>)
Declaration
public readonly SyntaxNodeOrToken WithTrailingTrivia(IEnumerable<SyntaxTrivia> trivia)
Parameters
Returns
WithTrailingTrivia(SyntaxTrivia[])
Declaration
public readonly SyntaxNodeOrToken WithTrailingTrivia(params SyntaxTrivia[] trivia)
Parameters
Returns
WriteTo(TextWriter)
Writes the full text of this node or token to the specified TextWriter.
Declaration
public readonly void WriteTo(TextWriter writer)
Parameters
| Type |
Name |
Description |
| System.IO.TextWriter |
writer |
|
Operators
Equality(SyntaxNodeOrToken, SyntaxNodeOrToken)
Declaration
public static bool operator ==(SyntaxNodeOrToken left, SyntaxNodeOrToken right)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Explicit(SyntaxNodeOrToken to SyntaxNode)
Declaration
public static explicit operator SyntaxNode(SyntaxNodeOrToken nodeOrToken)
Parameters
Returns
Explicit(SyntaxNodeOrToken to SyntaxToken)
Declaration
public static explicit operator SyntaxToken(SyntaxNodeOrToken nodeOrToken)
Parameters
Returns
Implicit(SyntaxNode to SyntaxNodeOrToken)
Declaration
public static implicit operator SyntaxNodeOrToken(SyntaxNode node)
Parameters
| Type |
Name |
Description |
| SyntaxNode |
node |
The input node.
|
Returns
Implicit(SyntaxToken to SyntaxNodeOrToken)
Declaration
public static implicit operator SyntaxNodeOrToken(SyntaxToken token)
Parameters
| Type |
Name |
Description |
| SyntaxToken |
token |
The input token.
|
Returns
Inequality(SyntaxNodeOrToken, SyntaxNodeOrToken)
Declaration
public static bool operator !=(SyntaxNodeOrToken left, SyntaxNodeOrToken right)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Implements
IEquatable<>