Struct ParsePosition
Denotes a position of a parser
public record struct ParsePosition : IComparable<ParsePosition>, IEquatable<ParsePosition>
- Implements
- Inherited Members
Constructors
ParsePosition(int, int)
Denotes a position of a parser
public ParsePosition(int Line, int Col)
Parameters
Properties
Col
The column of the position
public int Col { readonly get; set; }
Property Value
Line
The line of the position
public int Line { readonly get; set; }
Property Value
Methods
CompareTo(ParsePosition)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(ParsePosition other)
Parameters
otherParsePositionAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
Proceed(int)
Proceeds the position by the given number of characters
public ParsePosition Proceed(int chars)
Parameters
charsintthe numbers of characters to proceed
Returns
- ParsePosition
The updated parser position
Operators
operator +(ParsePosition, ParsePositionDelta)
Adds the given delta to the current position
public static ParsePosition operator +(ParsePosition pos, ParsePositionDelta delta)
Parameters
posParsePositionthe origin position
deltaParsePositionDeltathe position delta
Returns
- ParsePosition
the updated position
operator >(ParsePosition, ParsePosition)
Decides which of the two positions is greater
public static bool operator >(ParsePosition pos1, ParsePosition pos2)
Parameters
pos1ParsePositionthe first position
pos2ParsePositionthe second position
Returns
- bool
true, if the first position is greater, otherwise false
operator >=(ParsePosition, ParsePosition)
Decides which of the two positions is greater or equal
public static bool operator >=(ParsePosition pos1, ParsePosition pos2)
Parameters
pos1ParsePositionthe first position
pos2ParsePositionthe second position
Returns
- bool
true, if the first position is greater or equal, otherwise false
operator <(ParsePosition, ParsePosition)
Decides which of the two positions is smaller
public static bool operator <(ParsePosition pos1, ParsePosition pos2)
Parameters
pos1ParsePositionthe first position
pos2ParsePositionthe second position
Returns
- bool
true, if the first position is smaller, otherwise false
operator <=(ParsePosition, ParsePosition)
Decides which of the two positions is smaller or equal
public static bool operator <=(ParsePosition pos1, ParsePosition pos2)
Parameters
pos1ParsePositionthe first position
pos2ParsePositionthe second position
Returns
- bool
true, if the first position is smaller or equal, otherwise false
operator -(ParsePosition, ParsePosition)
Subtracts two parse positions
public static ParsePositionDelta operator -(ParsePosition to, ParsePosition from)
Parameters
toParsePositionthe forward position
fromParsePositionthe backward position
Returns
- ParsePositionDelta
The delta between the given positions