Table of Contents

Struct DfaEdge<TChar>

Namespace
Farkle.Grammars.StateMachines
Assembly
Farkle.dll

Maps a range of characters to a target DFA state.

public readonly struct DfaEdge<TChar> : IEquatable<DfaEdge<TChar>>

Type Parameters

TChar

The type of characters the DFA accepts. Typically it is char or byte.

Implements
Inherited Members

Constructors

DfaEdge(TChar, TChar, int)

Maps a range of characters to a target DFA state.

public DfaEdge(TChar keyFrom, TChar keyTo, int target)

Parameters

keyFrom TChar

The value of KeyFrom

keyTo TChar

The value of KeyTo

target int

The value of Target

Properties

KeyFrom

The first character in the range, inclusive.

public TChar KeyFrom { get; }

Property Value

TChar

KeyTo

The last character in the range, inclusive.

public TChar KeyTo { get; }

Property Value

TChar

Target

The index of the target DFA state, starting from 0.

public int Target { get; }

Property Value

int

Remarks

A negative value indicates that following this edge should stop the tokenizer.

Methods

Equals(DfaEdge<TChar>)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(DfaEdge<TChar> other)

Parameters

other DfaEdge<TChar>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Operators

operator ==(DfaEdge<TChar>, DfaEdge<TChar>)

Checks two DfaEdge<TChar>s for equality.

public static bool operator ==(DfaEdge<TChar> left, DfaEdge<TChar> right)

Parameters

left DfaEdge<TChar>

The first edge.

right DfaEdge<TChar>

The second edge.

Returns

bool

operator !=(DfaEdge<TChar>, DfaEdge<TChar>)

Checks two DfaEdge<TChar>s for inequality.

public static bool operator !=(DfaEdge<TChar> left, DfaEdge<TChar> right)

Parameters

left DfaEdge<TChar>

The first edge.

right DfaEdge<TChar>

The second edge.

Returns

bool