Struct SourceSpan
Namespace: OceanApocalypse.RSML.Toolchain.Abstractions.Sources
Assembly: RSML.Toolchain.Abstractions.dll
Represents a span taken from a source.
public readonly struct SourceSpan : IFormattable, IEquatable<SourceSpan>
Implements
IFormattable, IEquatable<SourceSpan>
Inherited Members
Object.Equals(Object?), Object.Equals(Object?, Object?), Object.GetHashCode(), Object.GetType(), Object.ReferenceEquals(Object?, Object?), Object.ToString()
Constructors
SourceSpan(SourceLocation, SourceLocation)
Initializes a new span given a starting and an end indexes.
public SourceSpan(SourceLocation start, SourceLocation end)
Parameters
start SourceLocation
The start index.
end SourceLocation
The end index.
Exceptions
The starting index is greater or equal to the end index.
Fields
Empty
An empty span.
public static readonly SourceSpan Empty
Field Value
Properties
End
The end of the span.
public SourceLocation End { get; }
Property Value
IsSingleLine
The span is located in a single line.
public Boolean IsSingleLine { get; }
Property Value
Length
The length of the span.
public Int32 Length { get; }
Property Value
Start
The start of the span.
public SourceLocation Start { get; }
Property Value
Methods
Equals(Object?)
Indicates whether this instance and a specified object are equal.
public override Boolean Equals(Object? obj)
Parameters
obj Object?
The object to compare with the current instance.
Returns
true if obj and this instance are the same type and represent the same value; otherwise, false.
Equals(SourceSpan)
Checks whether two SourceSpans are equals.
public Boolean Equals(SourceSpan other)
Parameters
other SourceSpan
The span to check against
Returns
True if equals
GetHashCode()
Returns the hash code for this instance.
public override Int32 GetHashCode()
Returns
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns a generic string representation of the current instance.
public override String ToString()
Returns
The string representation.
ToString(String?, IFormatProvider?)
Given a format, tries to return a string that uses said format as a basis for the representation.
If it fails, it defaults to ToString.
public String ToString(String? format, IFormatProvider? formatProvider)
Parameters
format String?
The format. Available formats are: CTOR (constructor-like string) and JSON (struct as JSON).
formatProvider IFormatProvider?
Unused. Don't bother assigning it anything.
Returns
The string representation.
Operators
operator ==(SourceSpan, SourceSpan)
Checks whether two SourceSpans are equals.
public static Boolean operator ==(SourceSpan left, SourceSpan right)
Parameters
left SourceSpan
right SourceSpan
Returns
True if equals
operator !=(SourceSpan, SourceSpan)
Checks whether two SourceSpans are different from each other.
public static Boolean operator !=(SourceSpan left, SourceSpan right)
Parameters
left SourceSpan
right SourceSpan
Returns
True if different