public new static TParenExpression Claim(StringClaimer claimer)
        {
            Claim lb = claimer.Claim(LeftBracket);

            if (!lb.Success)
            {
                return(null);
            }
            TParenExpression ptoken = new TParenExpression {
                _realExpression = TExpression.Claim(claimer)
            };

            if (ptoken._realExpression == null)
            {
                lb.Fail();
                return(null);
            }
            lb.Pass();
            Claim rb = claimer.Claim(RightBracket);

            if (rb.Success)
            {
                rb.Pass();            // right bracket is optional. So just pass it if we get it.
            }
            return(ptoken);
        }
示例#2
0
        public new static TBlock Claim(StringClaimer claimer)
        {
            Claim c = claimer.Claim(LeftBracket);

            if (!c.Success)
            {
                return(null);
            }
            c.Pass();
            TBlock      newBlock = new TBlock();
            TExpression nExp;

            while ((nExp = TExpression.Claim(claimer)) != null)
            {
                newBlock._expressions.Add(nExp);
                claimer.Claim(SemiColon);
                if (!(c = claimer.Claim(RightBracket)).Success)
                {
                    continue;
                }
                c.Pass();
                return(newBlock);
            }
            return(newBlock);
        }
示例#3
0
        public new static TArgExpression Claim(StringClaimer claimer)
        {
            TExpression heldExpr = TExpression.Claim(claimer);

            if (heldExpr == null)
            {
                return(null);
            }
            TArgExpression newArgExp = new TArgExpression {
                _heldExp = heldExpr
            };

            return(newArgExp);
        }
示例#4
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);
        }