Пример #1
0
    public static NeuKeyword?GetBoolKeyword(
        this NeuBoolLiteralExpression boolLitExpr)
    {
        foreach (var child in boolLitExpr.Children)
        {
            switch (child)
            {
            case NeuKeyword k
                when
                k.KeywordType == NeuKeywordType.True ||
                k.KeywordType == NeuKeywordType.False:

                return(k);

            ///

            default:

                break;
            }
        }

        ///

        return(null);
    }
    public static NeuOperation Execute(
        this NeuInterpreter interpreter,
        NeuBoolLiteralExpression boolLiteralExpr)
    {
        var boolKeyword = boolLiteralExpr.GetBoolKeyword();

        if (boolKeyword == null)
        {
            throw new Exception();
        }

        ///

        return(interpreter.Execute(boolKeyword));
    }