/// <summary>Checks the production of.</summary>
    /// <param name="x">The x.</param>
    /// <returns></returns>
    public bool CheckProductionOf(char x)
    {
        List <Production> productions = GrammarTools.GetProductionsOf((( Element )stack.Peek()).value, grammar);

        if (productions.Count == 0)
        {
            //GamEvent.instance.RejectRow
            return(false);
        }

        Production productioToCheck = GrammarTools.GetProductionWithValue(x, productions);

        if (productioToCheck is null)
        {
            //GamEvent.instance.RejectRow
            return(false);
        }

        else if (productioToCheck.rightSide.Count == 1)
        {
            stack.Pop();
        }

        else
        {
            stack.Pop();
            for (int i = productioToCheck.rightSide.Count - 1; i >= 1; i--)
            {
                stack.Push(productioToCheck.rightSide [i]);
            }
        }
        return(true);
    }
    /// <summary>Checks the production of.</summary>
    /// <param name="x">The x.</param>
    /// <returns></returns>
    public bool CheckProductionOf(char x)
    {
        List <Production> productions = GrammarTools.GetProductionsOf((( Element )stack.Peek()).value, grammar);

        if (productions.Count == 0)
        {
            //GamEvent.instance.RejectRow
            Debug.Log("Reject Row");
            return(false);
        }

        Production productioToCheck = GrammarTools.GetProductionWithValue(x, productions);



        if (productioToCheck is null)
        {
            if (!CheckSelectionSetOfPeek(productions, x) || !CheckProductionsRighSideStartNoTerminal(productions, x))
            {
                return(false);
            }
        }
        else
        {
            stack.Pop();
            if (productioToCheck.rightSide.Count >= 2)
            {
                for (int i = productioToCheck.rightSide.Count - 1; i >= 1; i--)
                {
                    stack.Push(productioToCheck.rightSide [i]);
                }
            }
        }

        return(true);
    }