Table of Contents

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 int

The index of the Position in the script.

line int

The line number of the Position in the script.

file string

The file name/path of the script.

script string

The 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

Position

Script

The script as text.

public readonly string Script

Field Value

string

Methods

Advance()

Advances the Position and increments Index by 1.

public Position Advance()

Returns

Position

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 char

The character associated with the Position before advancing.

Returns

Position

ReverseTo(int, int)

Reverses to the given index.

public Position ReverseTo(int index, int lineDecrement)

Parameters

index int

The index to reverse to.

lineDecrement int

The decrement for Line.

Returns

Position