Table of Contents

Struct ProductionHandle

Namespace
Farkle.Grammars
Assembly
Farkle.dll

Points to a Production of a Grammar.

public readonly struct ProductionHandle : IEquatable<ProductionHandle>
Implements
Inherited Members

Remarks

This type is lightweight, storing just a number without a Grammar object and can be of use when parsing. To get any information about the production you have to pass it to the GetProduction(ProductionHandle) method.

Properties

HasValue

Whether this ProductionHandle has a valid value.

public bool HasValue { get; }

Property Value

bool
See Also

Value

Gets the production's index in the grammar.

public int Value { get; }

Property Value

int

Remarks

The first production has a value of zero.

Exceptions

InvalidOperationException

The production's HasValue property is false.

See Also

Methods

Equals(ProductionHandle)

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

public bool Equals(ProductionHandle other)

Parameters

other ProductionHandle

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 ==(ProductionHandle, ProductionHandle)

Checks if two ProductionHandles are pointing to the same row.

public static bool operator ==(ProductionHandle left, ProductionHandle right)

Parameters

left ProductionHandle

The first handle.

right ProductionHandle

The second handle.

Returns

bool

Remarks

If left and right come from different Grammars the result is undefined.

explicit operator ProductionHandle(EntityHandle)

public static explicit operator ProductionHandle(EntityHandle handle)

Parameters

handle EntityHandle

The EntityHandle to cast.

Returns

ProductionHandle

Exceptions

InvalidCastException

handle's IsProduction property is false.

implicit operator EntityHandle(ProductionHandle)

Implicitly converts a ProductionHandle to an EntityHandle.

public static implicit operator EntityHandle(ProductionHandle handle)

Parameters

handle ProductionHandle

The ProductionHandle to convert.

Returns

EntityHandle

operator !=(ProductionHandle, ProductionHandle)

Checks if two ProductionHandles are not pointing to the same row.

public static bool operator !=(ProductionHandle left, ProductionHandle right)

Parameters

left ProductionHandle

The first handle.

right ProductionHandle

The second handle.

Returns

bool

Remarks

If left and right come from different Grammars the result is undefined.