Struct SyntaxNodeOrToken
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Loretta.CodeAnalysis.dll
Syntax
public readonly struct SyntaxNodeOrToken
Properties
|
Improve this Doc
View Source
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 |
|
|
Improve this Doc
View Source
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 |
|
|
Improve this Doc
View Source
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 |
|
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
HasLeadingTrivia
Determines whether the underlying node or token has any leading trivia.
Declaration
public readonly bool HasLeadingTrivia { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
HasTrailingTrivia
Determines whether the underlying node or token has any trailing trivia.
Declaration
public readonly bool HasTrailingTrivia { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
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 |
|
|
Improve this Doc
View Source
IsNode
Declaration
public readonly bool IsNode { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsToken
Declaration
public readonly bool IsToken { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Language
The language name that this node or token is syntax of.
Declaration
public readonly string Language { get; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Parent
The node that contains the underlying node or token in its Children collection.
Declaration
public readonly SyntaxNode Parent { get; }
Property Value
|
Improve this Doc
View Source
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 |
|
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
SpanStart
Declaration
public readonly int SpanStart { get; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
SyntaxTree
SyntaxTree which contains current SyntaxNodeOrToken.
Declaration
public readonly SyntaxTree SyntaxTree { get; }
Property Value
Methods
|
Improve this Doc
View Source
AsNode()
Declaration
public readonly SyntaxNode AsNode()
Returns
|
Improve this Doc
View Source
AsToken()
Declaration
public readonly SyntaxToken AsToken()
Returns
|
Improve this Doc
View Source
ChildNodesAndTokens()
The list of child nodes and tokens of the underlying node or token.
Declaration
public readonly ChildSyntaxList ChildNodesAndTokens()
Returns
|
Improve this Doc
View Source
Equals(SyntaxNodeOrToken)
Declaration
public readonly bool Equals(SyntaxNodeOrToken other)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
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)
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
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 |
|
|
Improve this Doc
View Source
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
GetLocation()
Get the location of this node or token.
Declaration
public readonly Location GetLocation()
Returns
|
Improve this Doc
View Source
GetNextSibling()
Returns the sibling to the right of this node or token.
Declaration
public readonly SyntaxNodeOrToken GetNextSibling()
Returns
|
Improve this Doc
View Source
GetPreviousSibling()
Returns the sibling to the left of this node or token.
Declaration
public readonly SyntaxNodeOrToken GetPreviousSibling()
Returns
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
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 |
|
|
Improve this Doc
View Source
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 |
|
|
Improve this Doc
View Source
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 |
|
|
Improve this Doc
View Source
IsEquivalentTo(SyntaxNodeOrToken)
Determines if the two nodes or tokens are equivalent.
Declaration
public readonly bool IsEquivalentTo(SyntaxNodeOrToken other)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsIncrementallyIdenticalTo(SyntaxNodeOrToken)
Declaration
public readonly bool IsIncrementallyIdenticalTo(SyntaxNodeOrToken other)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
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.
|
|
Improve this Doc
View Source
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()
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
WithLeadingTrivia(IEnumerable<SyntaxTrivia>)
Declaration
public readonly SyntaxNodeOrToken WithLeadingTrivia(IEnumerable<SyntaxTrivia> trivia)
Parameters
Returns
|
Improve this Doc
View Source
WithLeadingTrivia(SyntaxTrivia[])
Declaration
public readonly SyntaxNodeOrToken WithLeadingTrivia(params SyntaxTrivia[] trivia)
Parameters
Returns
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
WithTrailingTrivia(IEnumerable<SyntaxTrivia>)
Declaration
public readonly SyntaxNodeOrToken WithTrailingTrivia(IEnumerable<SyntaxTrivia> trivia)
Parameters
Returns
|
Improve this Doc
View Source
WithTrailingTrivia(SyntaxTrivia[])
Declaration
public readonly SyntaxNodeOrToken WithTrailingTrivia(params SyntaxTrivia[] trivia)
Parameters
Returns
|
Improve this Doc
View Source
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
|
Improve this Doc
View Source
Equality(SyntaxNodeOrToken, SyntaxNodeOrToken)
Declaration
public static bool operator ==(SyntaxNodeOrToken left, SyntaxNodeOrToken right)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Explicit(SyntaxNodeOrToken to SyntaxNode)
Declaration
public static explicit operator SyntaxNode(SyntaxNodeOrToken nodeOrToken)
Parameters
Returns
|
Improve this Doc
View Source
Explicit(SyntaxNodeOrToken to SyntaxToken)
Declaration
public static explicit operator SyntaxToken(SyntaxNodeOrToken nodeOrToken)
Parameters
Returns
|
Improve this Doc
View Source
Implicit(SyntaxNode to SyntaxNodeOrToken)
Declaration
public static implicit operator SyntaxNodeOrToken(SyntaxNode node)
Parameters
Type |
Name |
Description |
SyntaxNode |
node |
The input node.
|
Returns
|
Improve this Doc
View Source
Implicit(SyntaxToken to SyntaxNodeOrToken)
Declaration
public static implicit operator SyntaxNodeOrToken(SyntaxToken token)
Parameters
Type |
Name |
Description |
SyntaxToken |
token |
The input token.
|
Returns
|
Improve this Doc
View Source
Inequality(SyntaxNodeOrToken, SyntaxNodeOrToken)
Declaration
public static bool operator !=(SyntaxNodeOrToken left, SyntaxNodeOrToken right)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Implements
IEquatable<>
Extension Methods