Exemple #1
0
 private static TExpression pre_claim(StringClaimer claimer)
 {
     return(TAssignment.Claim(claimer) ??
            TIf.Claim(claimer) ??
            TFor.Claim(claimer) ??
            TWhile.Claim(claimer) ??
            TVariable.Claim(claimer) ??
            TLiteral.Claim(claimer) ??
            TParenExpression.Claim(claimer) ??
            TBlock.Claim(claimer)               as TExpression);
 }
Exemple #2
0
        public new static TAssignment Claim(StringClaimer claimer)
        {
            Claim failTo = claimer.FailPoint();

            TVariable toAssign = TVariable.Claim(claimer);

            if (toAssign == null)
            {
                failTo.Fail();
                return(null);
            }

            TOperator newOp = TOperator.Claim(claimer);

            Claim c = claimer.Claim(Set);

            if (!c.Success)
            {
                failTo.Fail();
                return(null);
            }
            TExpression assignValue = TExpression.Claim(claimer);

            if (assignValue == null)
            {
                failTo.Fail();
                return(null);
            }

            TAssignment newAssign = new TAssignment
            {
                _var   = toAssign,
                _op    = newOp,
                _value = assignValue
            };

            return(newAssign);
        }