Struct Position
- Namespace
- EzrSquared
- Assembly
- ezrSquared-lib.dll
The representation of a position in the script.
public readonly struct Position
Constructors
Position(int, int, string, string)
The representation of a position in the script.
public Position(int index, int line, string file, string script)
Parameters
index
intThe index of the Position in the script.
line
intThe line number of the Position in the script.
file
stringThe file name/path of the script.
script
stringThe script as text.
Fields
File
The file name/path of the script.
public readonly string File
Field Value
- string
Index
The index of the Position in the script.
public readonly int Index
Field Value
- int
Line
The line number of the Position in the script.
public readonly int Line
Field Value
- int
None
A position that does not exist.
public static readonly Position None
Field Value
Script
The script as text.
public readonly string Script
Field Value
- string
Methods
Advance()
public Position Advance()
Returns
Advance(char)
Advances the Position and increments Index by 1. If currentChar
is a new-line character, Line is also incremented by 1.
public Position Advance(char currentChar)
Parameters
currentChar
charThe character associated with the Position before advancing.
Returns
ReverseTo(int, int)
Reverses to the given index.
public Position ReverseTo(int index, int lineDecrement)
Parameters
index
intThe index to reverse to.
lineDecrement
intThe decrement for Line.