Table of Contents

Struct LrAction

Namespace
Farkle.Grammars.StateMachines
Assembly
Farkle.dll

Specifies what an LR parser will do if it encounters a terminal.

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

Properties

Error

An LrAction that will cause a syntax error.

public static LrAction Error { get; }

Property Value

LrAction
See Also

IsError

Whether this LrAction will cause a syntax error.

public bool IsError { get; }

Property Value

bool
See Also

IsReduce

Whether this LrAction will reduce a production.

public bool IsReduce { get; }

Property Value

bool
See Also

IsShift

Whether this LrAction will shift to another state.

public bool IsShift { get; }

Property Value

bool
See Also

ReduceProduction

The production this LrAction will reduce.

public ProductionHandle ReduceProduction { get; }

Property Value

ProductionHandle

Exceptions

InvalidOperationException

The IsReduce property is false.

ShiftState

The state this LrAction will shift to.

public int ShiftState { get; }

Property Value

int

Exceptions

InvalidOperationException

The IsShift property is false.

Methods

CreateReduce(ProductionHandle)

Creates an LrAction that will reduce the specified ProductionHandle.

public static LrAction CreateReduce(ProductionHandle production)

Parameters

production ProductionHandle

The production to reuse.

Returns

LrAction

Exceptions

ArgumentNullException

production's HasValue property is false.

See Also

CreateShift(int)

Creates an LrAction that will shift to the specified state.

public static LrAction CreateShift(int state)

Parameters

state int

The state's number, starting from zero.

Returns

LrAction

Exceptions

ArgumentOutOfRangeException

state is negative.

See Also

Equals(LrAction)

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

public bool Equals(LrAction other)

Parameters

other LrAction

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? other)

Parameters

other object

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

Checks two LrActions for equality.

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

Parameters

left LrAction

The first action.

right LrAction

The second action.

Returns

bool

operator !=(LrAction, LrAction)

Checks two LrActions for inequality.

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

Parameters

left LrAction

The first action.

right LrAction

The second action.

Returns

bool