Struct SourcePosDelta
Represents a difference in textual lines and columns corresponding to a region of an input stream.
Implements
Inherited Members
- ValueType.ToString()
- object.GetType()
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
Declaration
public readonly struct SourcePosDelta : IEquatable<SourcePosDelta>, IComparable<SourcePosDelta>
Constructors
SourcePosDelta(int, int)
Create a new SourcePosDelta with the specified number of lines and columns.
Declaration
public SourcePosDelta(int lines, int cols)
Parameters
Type | Name | Description |
---|---|---|
lines |
The number of lines. |
|
cols |
The number of columns. |
Properties
Cols
Gets the number of columns represented by the SourcePosDelta.
Declaration
public int Cols { get; }
Property Value
Type | Description |
---|---|
The number of columns. |
Lines
Gets the number of lines represented by the SourcePosDelta.
Declaration
public int Lines { get; }
Property Value
Type | Description |
---|---|
The number of lines. |
NewLine
A SourcePosDelta representing a newline being consumed.
Declaration
public static SourcePosDelta NewLine { get; }
Property Value
Type | Description |
---|---|
OneCol
A SourcePosDelta representing a single column being consumed.
Declaration
public static SourcePosDelta OneCol { get; }
Property Value
Type | Description |
---|---|
Zero
A SourcePosDelta representing no change in the source position.
Declaration
public static SourcePosDelta Zero { get; }
Property Value
Type | Description |
---|---|
Methods
Add(SourcePosDelta)
Add two SourcePosDeltas.
Declaration
public SourcePosDelta Add(SourcePosDelta other)
Parameters
Type | Name | Description |
---|---|---|
other |
The SourcePosDelta to add to this one. |
Returns
Type | Description |
---|---|
A SourcePosDelta representing the composition of this and |
CompareTo(SourcePosDelta)
Represents a difference in textual lines and columns corresponding to a region of an input stream.
Declaration
public int CompareTo(SourcePosDelta other)
Parameters
Type | Name | Description |
---|---|---|
other |
Returns
Type | Description |
---|---|
Equals(SourcePosDelta)
Represents a difference in textual lines and columns corresponding to a region of an input stream.
Declaration
public bool Equals(SourcePosDelta other)
Parameters
Type | Name | Description |
---|---|---|
other |
Returns
Type | Description |
---|---|
Equals(object?)
Represents a difference in textual lines and columns corresponding to a region of an input stream.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
obj |
Returns
Type | Description |
---|---|
Overrides
GetHashCode()
Represents a difference in textual lines and columns corresponding to a region of an input stream.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Overrides
Plus(SourcePosDelta)
Add two SourcePosDeltas.
Declaration
public SourcePosDelta Plus(SourcePosDelta other)
Parameters
Type | Name | Description |
---|---|---|
other |
The SourcePosDelta to add to this one. |
Returns
Type | Description |
---|---|
A SourcePosDelta representing the composition of this and |
Operators
operator +(SourcePosDelta, SourcePosDelta)
Add two SourcePosDeltas.
Declaration
public static SourcePosDelta operator +(SourcePosDelta left, SourcePosDelta right)
Parameters
Type | Name | Description |
---|---|---|
left |
The first SourcePosDelta. |
|
right |
The SourcePosDelta to add to |
Returns
Type | Description |
---|---|
A SourcePosDelta representing the composition of |
operator ==(SourcePosDelta, SourcePosDelta)
Equality operator.
Declaration
public static bool operator ==(SourcePosDelta left, SourcePosDelta right)
Parameters
Type | Name | Description |
---|---|---|
left |
The left SourcePosDelta. |
|
right |
The right SourcePosDelta. |
Returns
Type | Description |
---|---|
operator >(SourcePosDelta, SourcePosDelta)
Comparison operator.
Declaration
public static bool operator >(SourcePosDelta left, SourcePosDelta right)
Parameters
Type | Name | Description |
---|---|---|
left |
The left SourcePosDelta. |
|
right |
The right SourcePosDelta. |
Returns
Type | Description |
---|---|
operator >=(SourcePosDelta, SourcePosDelta)
Comparison operator.
Declaration
public static bool operator >=(SourcePosDelta left, SourcePosDelta right)
Parameters
Type | Name | Description |
---|---|---|
left |
The left SourcePosDelta. |
|
right |
The right SourcePosDelta. |
Returns
Type | Description |
---|---|
operator !=(SourcePosDelta, SourcePosDelta)
Inequality operator.
Declaration
public static bool operator !=(SourcePosDelta left, SourcePosDelta right)
Parameters
Type | Name | Description |
---|---|---|
left |
The left SourcePosDelta. |
|
right |
The right SourcePosDelta. |
Returns
Type | Description |
---|---|
operator <(SourcePosDelta, SourcePosDelta)
Comparison operator.
Declaration
public static bool operator <(SourcePosDelta left, SourcePosDelta right)
Parameters
Type | Name | Description |
---|---|---|
left |
The left SourcePosDelta. |
|
right |
The right SourcePosDelta. |
Returns
Type | Description |
---|---|
operator <=(SourcePosDelta, SourcePosDelta)
Comparison operator.
Declaration
public static bool operator <=(SourcePosDelta left, SourcePosDelta right)
Parameters
Type | Name | Description |
---|---|---|
left |
The left SourcePosDelta. |
|
right |
The right SourcePosDelta. |
Returns
Type | Description |
---|---|