Table of Contents

Struct ParsePosition

Namespace
NMF.AnyText
Assembly
NMF.AnyText.Core.dll

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

Line int

The line of the position

Col int

The column of the position

Properties

Col

The column of the position

public int Col { readonly get; set; }

Property Value

int

Line

The line of the position

public int Line { readonly get; set; }

Property Value

int

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

other ParsePosition

An 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 other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

Proceed(int)

Proceeds the position by the given number of characters

public ParsePosition Proceed(int chars)

Parameters

chars int

the 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

pos ParsePosition

the origin position

delta ParsePositionDelta

the 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

pos1 ParsePosition

the first position

pos2 ParsePosition

the 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

pos1 ParsePosition

the first position

pos2 ParsePosition

the 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

pos1 ParsePosition

the first position

pos2 ParsePosition

the 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

pos1 ParsePosition

the first position

pos2 ParsePosition

the 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

to ParsePosition

the forward position

from ParsePosition

the backward position

Returns

ParsePositionDelta

The delta between the given positions