Example #1
0
        public new static TOperator Claim(StringClaimer claimer)
        {
            foreach (var thisOp in Operators)
            {
                Claim c = claimer.Claim(thisOp.Regex);
                if (!c.Success)
                {
                    continue;
                }
                c.Pass();
                TOperator newOp = new TOperator {
                    _op = thisOp
                };
                return(newOp);
            }

            return(null);
        }
Example #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);
        }