While.Parsing.Parser.UnaryOperator C# (CSharp) Метод

UnaryOperator() публичный Метод

public UnaryOperator ( Expression &exp ) : void
exp Expression
Результат void
        void UnaryOperator(out Expression exp)
        {
            Token tok = null; string op = null;
            if (la.kind == 41 || la.kind == 45 || la.kind == 46) {
            if (la.kind == 41) {
                Get();
                tok = t; op = t.val;
            } else if (la.kind == 45) {
                Get();
                tok = t; op = t.val;
            } else {
                Get();
                tok = t; op = t.val;
            }
            }
            Terminal(out exp);
            if (op == "-") {
            if (!ExpectInt(exp, tok, true)) { return; }
            exp = new UnaryMinus((TypedExpression<int>)exp);
            } else if (op == "~") {
            if (!ExpectInt((TypedExpression<int>)exp, tok, true)) { return; }
            exp = new OnesComplement((TypedExpression<int>)exp);
            } else if (op == "not") {
            if (!ExpectBool(exp, tok, true)) { return; }
            exp = new Not((TypedExpression<bool>)exp);
            }
        }