Пример #1
0
        void Binding(ElaEquationSet block)
        {
            var bid = default(ElaEquation);
            var left = default(ElaExpression);
            var right = default(ElaExpression);

            Expr(out left);
            bid = new ElaEquation(t);
            if (la.kind == 23 || la.kind == 51 || la.kind == 57) {
            if (la.kind == 57) {
                Get();
                Expr(out right);
            } else if (la.kind == 23) {
                Get();
                Guard(out right);
            } else {
                Attribute(ref left);
            }
            }
            if (la.kind == 43) {
            var cb = default(ElaEquationSet);
            WhereBinding(out cb);
            if (left != null && left.Type == ElaNodeType.Header)
               AddError(ElaParserError.InvalidAttributeWhere);

                var letb = new ElaLetBinding();
                   if (cb != null) letb.SetLinePragma(cb.Line, cb.Column);
                   letb.Equations = cb;

                if (right != null)
                {
                    letb.Expression = right;
                       right = letb;
                }
                else
                {
                    letb.Expression = left;
                    left = letb;
                }

            }
            ProcessBinding(block, bid, left, right);
        }
Пример #2
0
        void DoBlockStmt(ref ElaExpression eqt)
        {
            var cexp1 = default(ElaExpression);
            var cexp2 = default(ElaExpression);

            if (StartOf(4)) {
            EmbExpr(out cexp1);
            if (la.kind == 64) {
                Get();
                EmbExpr(out cexp2);
            }
            ProcessDoBlock(cexp1, cexp2, ref eqt);
            } else if (la.kind == 32) {
            scanner.InjectBlock();
            var eqs = new ElaEquationSet();

            Get();
            Binding(eqs);
            if (eqt.Type == ElaNodeType.LetBinding)
               ((ElaLetBinding)eqt).Equations.Equations.AddRange(eqs.Equations);
            else
            {
                var lt = new ElaLetBinding(t);
                lt.Equations = eqs;
                if (eqt.Type == ElaNodeType.Lambda)
                    ((ElaLambda)eqt).Right = lt;
                else
                    lt.Expression = eqt;
                eqt = lt;
            }

            EndBlock();
            } else SynErr(117);
        }
Пример #3
0
        void LetBinding(out ElaExpression exp)
        {
            exp = null;
            while (!(la.kind == 0 || la.kind == 32)) {SynErr(99); Get();}
            Expect(32);
            var bid = new ElaLetBinding(t);
            var block = default(ElaEquationSet);
            var cexp = default(ElaExpression);
            exp = bid;

            BindingChain(out block);
            Expect(28);
            Expr(out cexp);
            bid.Equations = block;
            bid.Expression = cexp;
        }