Struct SyntaxTrivia
Represents a trivia in the syntax tree.
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 SyntaxTrivia
Properties
|
Improve this Doc
View Source
ContainsDiagnostics
Determines whether this trivia has any diagnostics on it. If this trivia is a structured trivia then the
returned value will indicate whether this trivia 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
FullSpan
The absolute span of this trivia in characters. If this trivia is a structured trivia then the returned span
will include spans of any leading or trailing trivia present on the child non-terminal node of this trivia.
Declaration
public readonly TextSpan FullSpan { get; }
Property Value
|
Improve this Doc
View Source
HasStructure
Determines whether this trivia is a structured trivia.
Declaration
public readonly bool HasStructure { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsDirective
Determines whether this trivia represents a preprocessor directive.
Declaration
public readonly bool IsDirective { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Language
The language name that this trivia is syntax of.
Declaration
public readonly string Language { get; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
RawKind
An integer representing the language specific kind of this trivia.
Declaration
public readonly int RawKind { get; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Span
The absolute span of this trivia in characters. If this trivia is a structured trivia then the returned span
will not include spans of any leading or trailing trivia present on the child non-terminal node of this
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 SyntaxTrivia.
Declaration
public readonly SyntaxTree SyntaxTree { get; }
Property Value
|
Improve this Doc
View Source
Token
The parent token that contains this token in its LeadingTrivia or TrailingTrivia collection.
Declaration
public readonly SyntaxToken Token { get; }
Property Value
Methods
|
Improve this Doc
View Source
CopyAnnotationsTo(SyntaxTrivia)
Copies all SyntaxAnnotations, if any, from this SyntaxTrivia instance and attaches them to a new instance based on trivia
.
Declaration
public readonly SyntaxTrivia CopyAnnotationsTo(SyntaxTrivia trivia)
Parameters
Returns
|
Improve this Doc
View Source
Equals(SyntaxTrivia)
Declaration
public readonly bool Equals(SyntaxTrivia 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(String)
Get all the 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
GetAnnotations(String[])
Get all the annotations of the specified annotation kinds.
Declaration
public readonly IEnumerable<SyntaxAnnotation> GetAnnotations(params string[] annotationKinds)
Parameters
Type |
Name |
Description |
System.String[] |
annotationKinds |
|
Returns
|
Improve this Doc
View Source
GetDiagnostics()
Gets a list of all the diagnostics associated with this 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
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
|
Improve this Doc
View Source
GetLocation()
Get the location of this trivia.
Declaration
public readonly Location GetLocation()
Returns
|
Improve this Doc
View Source
GetStructure()
Returns the child non-terminal node representing the syntax tree structure under this structured trivia.
Declaration
public readonly SyntaxNode GetStructure()
Returns
Type |
Description |
SyntaxNode |
The child non-terminal node representing the syntax tree structure under this structured
trivia.
|
|
Improve this Doc
View Source
HasAnnotation(SyntaxAnnotation)
Determines whether this trivia has the specific annotation.
Declaration
public readonly bool HasAnnotation(SyntaxAnnotation annotation)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
HasAnnotations(String)
Determines where this trivia has annotations of the specified annotation 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
HasAnnotations(String[])
Determines where this trivia has any annotations of the specified annotation kinds.
Declaration
public readonly bool HasAnnotations(params string[] annotationKinds)
Parameters
Type |
Name |
Description |
System.String[] |
annotationKinds |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsEquivalentTo(SyntaxTrivia)
Determines if this trivia is equivalent to the specified trivia.
Declaration
public readonly bool IsEquivalentTo(SyntaxTrivia trivia)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsPartOfStructuredTrivia()
Determines whether this trivia is a descendant of a structured trivia.
Declaration
public readonly bool IsPartOfStructuredTrivia()
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
ToFullString()
Returns the full string representation of this trivia. If this trivia is structured trivia then the returned string will
include any leading or trailing trivia present on the StructuredTriviaSyntax node of this trivia.
Declaration
public readonly string ToFullString()
Returns
Type |
Description |
System.String |
The full string representation of this trivia.
|
|
Improve this Doc
View Source
ToString()
Returns the string representation of this trivia. If this trivia is structured trivia then the returned string
will not include any leading or trailing trivia present on the StructuredTriviaSyntax node of this trivia.
Declaration
public override readonly string ToString()
Returns
Type |
Description |
System.String |
The string representation of this trivia.
|
Overrides
System.ValueType.ToString()
|
Improve this Doc
View Source
WithAdditionalAnnotations(IEnumerable<SyntaxAnnotation>)
Creates a new SyntaxTrivia with the specified annotations.
Declaration
public readonly SyntaxTrivia WithAdditionalAnnotations(IEnumerable<SyntaxAnnotation> annotations)
Parameters
Returns
|
Improve this Doc
View Source
WithAdditionalAnnotations(SyntaxAnnotation[])
Creates a new SyntaxTrivia with the specified annotations.
Declaration
public readonly SyntaxTrivia WithAdditionalAnnotations(params SyntaxAnnotation[] annotations)
Parameters
Returns
|
Improve this Doc
View Source
WithoutAnnotations(IEnumerable<SyntaxAnnotation>)
Creates a new SyntaxTrivia without the specified annotations.
Declaration
public readonly SyntaxTrivia WithoutAnnotations(IEnumerable<SyntaxAnnotation> annotations)
Parameters
Returns
|
Improve this Doc
View Source
WithoutAnnotations(SyntaxAnnotation[])
Creates a new SyntaxTrivia without the specified annotations.
Declaration
public readonly SyntaxTrivia WithoutAnnotations(params SyntaxAnnotation[] annotations)
Parameters
Returns
|
Improve this Doc
View Source
WithoutAnnotations(String)
Creates a new SyntaxTrivia without annotations of the specified kind.
Declaration
public readonly SyntaxTrivia WithoutAnnotations(string annotationKind)
Parameters
Type |
Name |
Description |
System.String |
annotationKind |
|
Returns
|
Improve this Doc
View Source
WriteTo(TextWriter)
Writes the full text of this trivia 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(SyntaxTrivia, SyntaxTrivia)
Declaration
public static bool operator ==(SyntaxTrivia left, SyntaxTrivia right)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Inequality(SyntaxTrivia, SyntaxTrivia)
Declaration
public static bool operator !=(SyntaxTrivia left, SyntaxTrivia right)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Implements
IEquatable<>
Extension Methods