Exemplo n.º 1
0
        public ExprSeq ParseExprSeq(ParseFlag flags = ParseFlag.None)
        {
            CurrentState.ParseFlags |= flags;
            //
            ExprSeq = new ExprSeq();
            Expression expr = null;

            if (CurrentToken.Kind == TokenKind.RoundList)
            {
                if (CurrentList.Count != 0)
                {
                    CreateState(CurrentList);
                    expr = ParseExpression();
                    PopState();
                }
                Advance();
            }
            else
            {
                expr = ParseExpression();
            }
            if (expr == null)
            {
                return(null);
            }
            if (!(expr is ClauseExpr))
            {
                //Debug.Print(expr.ToString());
                ExprSeq.AddChild(expr);
            }

            return(ExprSeq);
        }
Exemplo n.º 2
0
        public ClauseExpr EvalClause(Token op)
        {
            Expression argument  = PopExpr();
            Expression subject   = PopExpr();
            Expression klassExpr = null;

            if (subject == Expression.Nil)
            {
                subject   = BuiltinDefs.Self.CreateName();
                klassExpr = BuiltinDefs.Perform.CreateName();
            }
            else if (subject.IsClauseExpr)
            {
                subject = new Name(TokenInstance.CSharp._BWXSUBJECT);
            }
            Expression predicate = new Name(op);
            ClauseExpr expr      = new ClauseExpr(subject, predicate, argument);

            expr.AtomTypeExpr = klassExpr;

            PushExpr(expr);
            //
            ExprSeq.AddChild(expr);
            return(expr);
        }
Exemplo n.º 3
0
        public void EvalEqual(Token op)
        {
            Expression argument = PopExpr();
            Expression subject  = PopExpr();
            Expression expr     = Create.Equal(op, subject, argument);

            ExprSeq.AddChild(expr);
            PushExpr(expr);
        }