コード例 #1
0
ファイル: Deffact.cs プロジェクト: joaocc/creshendo--git
        /// <summary>
        /// </summary>
        /// <param name="">util
        ///
        /// </param>
        public virtual void compileBinding(Rule.IRule util)
        {
            List <object> list = new List <Object>();

            for (int idx = 0; idx < slots.Length; idx++)
            {
                if (slots[idx].Value is BoundParam)
                {
                    hasBinding_Renamed_Field = true;
                    list.Add(slots[idx]);
                    BoundParam bp = (BoundParam)slots[idx].Value;
                    Binding    bd = util.getBinding(bp.VariableName);
                    if (bd != null)
                    {
                        bp.rowId  = bd.LeftRow;
                        bp.column = bd.LeftIndex;
                    }
                }
            }
            if (list.Count > 0)
            {
                Slot[] ary = new Slot[list.Count];
                list.CopyTo(ary, 0);
                boundSlots = ary;
            }
        }
コード例 #2
0
ファイル: Deffact.cs プロジェクト: joaocc/creshendo--git
 public virtual void resolveValues(Rete engine, IFact[] triggerFacts)
 {
     for (int idx = 0; idx < boundSlots.Length; idx++)
     {
         if (boundSlots[idx] is MultiSlot)
         {
             // for multislot we have to resolve each slot
             Object[] mvals = (Object[])((MultiSlot)boundSlots[idx]).Value;
             for (int mdx = 0; mdx < mvals.Length; mdx++)
             {
                 if (mvals[mdx] is BoundParam)
                 {
                     BoundParam bp = (BoundParam)mvals[mdx];
                     bp.ResolvedValue = engine.getBinding(bp.VariableName);
                 }
             }
         }
         else if (boundSlots[idx].Value is BoundParam)
         {
             BoundParam bp = (BoundParam)boundSlots[idx].Value;
             if (bp.column > -1)
             {
                 bp.Facts = triggerFacts;
             }
             else
             {
                 bp.ResolvedValue = engine.getBinding(bp.VariableName);
             }
         }
     }
 }
コード例 #3
0
        /// <summary> the class overrides the method to include the additional
        /// attributes.
        /// </summary>
        public override String toPPString()
        {
            StringBuilder buf = new StringBuilder();

            buf.Append("(" + deftemplate.Name);
            if (slots.Length > 0)
            {
                buf.Append(" ");
            }
            for (int idx = 0; idx < slots.Length; idx++)
            {
                if (slots[idx].Value is BoundParam)
                {
                    BoundParam bp = (BoundParam)slots[idx].Value;
                    buf.Append("(" + slots[idx].Name + " ?" + bp.VariableName + ") ");
                }
                else
                {
                    buf.Append("(" + slots[idx].Name + " " + ConversionUtils.formatSlot(slots[idx].Value) + ") ");
                }
            }
            // append the temporal attributes
            buf.Append("(" + TemporalFact_Fields.EXPIRATION + " " + expirationTime + ")");
            buf.Append("(" + TemporalFact_Fields.SERVICE_TYPE + " " + serviceType + ")");
            buf.Append("(" + TemporalFact_Fields.SOURCE + " " + sourceURL + ")");
            buf.Append("(" + TemporalFact_Fields.VALIDITY + " " + validity + ") ");
            buf.Append(")");
            return(buf.ToString());
        }
コード例 #4
0
 /// <summary>
 /// *
 /// </summary>
 protected internal virtual void initParams()
 {
     for (int idx = 0; idx < params_Renamed.Length; idx++)
     {
         if (params_Renamed[idx].ObjectBinding)
         {
             params_Renamed[idx].Facts = facts;
         }
         else if (params_Renamed[idx] is BoundParam)
         {
             // we look up the value
             BoundParam bp  = (BoundParam)params_Renamed[idx];
             Object     val = engine.getDefglobalValue(bp.VariableName);
             bp.ResolvedValue = val;
         }
     }
 }
コード例 #5
0
ファイル: Deffact.cs プロジェクト: joaocc/creshendo--git
 /// <summary> update the slots
 /// </summary>
 public virtual void updateSlots(Rete engine, Slot[] updates)
 {
     for (int idx = 0; idx < updates.Length; idx++)
     {
         Slot uslot = updates[idx];
         if (uslot.Value is BoundParam)
         {
             BoundParam bp  = (BoundParam)uslot.Value;
             Object     val = engine.getBinding(bp.VariableName);
             slots[uslot.Id].Value = val;
         }
         else
         {
             slots[uslot.Id].Value = uslot.Value;
         }
     }
     timeStamp_Renamed_Field = (DateTime.Now.Ticks - 621355968000000000) / 10000;
 }
コード例 #6
0
 public virtual void configure(Rete engine, Rule.IRule util)
 {
     if (this.engine == null)
     {
         this.engine = engine;
     }
     for (int idx = 0; idx < params_Renamed.Length; idx++)
     {
         if (params_Renamed[idx] is BoundParam)
         {
             // we need to set the row value if the binding is a slot or fact
             BoundParam bp = (BoundParam)params_Renamed[idx];
             Binding    b1 = util.getBinding(bp.VariableName);
             if (b1 != null)
             {
                 bp.Row = b1.LeftRow;
                 if (b1.LeftIndex == -1)
                 {
                     bp.setObjectBinding(true);
                 }
             }
         }
     }
 }
コード例 #7
0
ファイル: Deffact.cs プロジェクト: joaocc/creshendo--git
        public virtual String toPPString()
        {
            StringBuilder buf = new StringBuilder();

            buf.Append("(" + deftemplate.Name);
            if (slots.Length > 0)
            {
                buf.Append(" ");
            }
            for (int idx = 0; idx < slots.Length; idx++)
            {
                if (slots[idx].Value is BoundParam)
                {
                    BoundParam bp = (BoundParam)slots[idx].Value;
                    buf.Append("(" + slots[idx].Name + " ?" + bp.VariableName + ") ");
                }
                else
                {
                    buf.Append("(" + slots[idx].Name + " " + ConversionUtils.formatSlot(slots[idx].Value) + ") ");
                }
            }
            buf.Append(")");
            return(buf.ToString());
        }
コード例 #8
0
ファイル: TestNode.cs プロジェクト: joaocc/creshendo--git
 /// <summary>
 /// </summary>
 public override String toPPString()
 {
     if (ppstring == null)
     {
         StringBuilder buf = new StringBuilder();
         buf.Append("TestNode-" + nodeID + "> (test (" + func.Name);
         for (int idx = 0; idx < params_Renamed.Length; idx++)
         {
             if (params_Renamed[idx] is BoundParam)
             {
                 BoundParam bp = (BoundParam)params_Renamed[idx];
                 buf.Append(" ?" + bp.VariableName);
             }
             else if (params_Renamed[idx] is ValueParam)
             {
                 ValueParam vp = (ValueParam)params_Renamed[idx];
                 buf.Append(" " + vp.StringValue);
             }
         }
         buf.Append(") )");
         ppstring = buf.ToString();
     }
     return(ppstring);
 }
コード例 #9
0
        public void actionParams(IList list)
        {
            Object exp;
            ValueParam vp = null;
            switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
            {
                case CLIPSParserConstants_Fields.BIND:
                    exp = jj_consume_token(CLIPSParserConstants_Fields.BIND);
                    if (exp is Token)
                    {
                        BoundParam bp = new BoundParam();
                        bp.VariableName = ((Token) exp).image.Substring(1);
                        list.Add(bp);
                    }
                    break;

                case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                case CLIPSParserConstants_Fields.FLOATING_POINT_LITERAL:
                case CLIPSParserConstants_Fields.STRING_LITERAL:
                case CLIPSParserConstants_Fields.PATH_LITERAL:
                    exp = typeExpr();
                    vp = new ValueParam();
                    if (exp is Token)
                    {
                        vp.Value = ((Token) exp).image;
                    }
                    else
                    {
                        vp.Value = exp;
                    }
                    if (exp is Int64)
                    {
                        vp.ValueType = Constants.LONG_PRIM_TYPE;
                    }
                    else if (exp is Single)
                    {
                        vp.ValueType = Constants.DOUBLE_PRIM_TYPE;
                    }
                    else if (exp is String)
                    {
                        vp.ValueType = Constants.STRING_TYPE;
                    }
                    list.Add(vp);
                    break;

                case CLIPSParserConstants_Fields.IDENTIFIER:
                    exp = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                    vp = new ValueParam();
                    vp.ValueType = Constants.STRING_TYPE;
                    if (exp is Token)
                    {
                        vp.Value = ((Token) exp).image;
                    }
                    else
                    {
                        vp.Value = exp;
                    }
                    list.Add(vp);
                    break;

                default:
                    jj_la1[60] = jj_gen;
                    jj_consume_token(- 1);
                    throw new ParseException();
            }
        }
コード例 #10
0
 public void actionParams(ArrayList list)
 {
     Object exp;
     ValueParam vp = null;
     switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
     {
         case BIND:
             exp = mcc_consume_token(BIND);
             if (exp is Token)
             {
                 BoundParam bp = new BoundParam();
                 bp.VariableName = ((Token) exp).image.Substring(1);
                 list.Add(bp);
             }
             break;
         case INTEGER_LITERAL:
         case FLOATING_POINT_LITERAL:
         case STRING_LITERAL:
         case PATH_LITERAL:
             exp = typeExpr();
             vp = new ValueParam();
             if (exp is Token)
             {
                 vp.Value = ((Token) exp).image;
             }
             else
             {
                 vp.Value = exp;
             }
             if (exp is long)
             {
                 vp.ValueType = Constants.LONG_PRIM_TYPE;
             }
             else if (exp is float)
             {
                 vp.ValueType = Constants.DOUBLE_PRIM_TYPE;
             }
             else if (exp is String)
             {
                 vp.ValueType = Constants.STRING_TYPE;
             }
             list.Add(vp);
             break;
         case IDENTIFIER:
             exp = mcc_consume_token(IDENTIFIER);
             vp = new ValueParam();
             vp.ValueType = Constants.STRING_TYPE;
             if (exp is Token)
             {
                 vp.Value = ((Token) exp).image;
             }
             else
             {
                 vp.Value = exp;
             }
             list.Add(vp);
             break;
         default:
             mcc_la1[62] = mcc_gen;
             mcc_consume_token(-1);
             throw new ParseException();
     }
 }
コード例 #11
0
 public void predicateFunc(ArrayList list, Token identifier)
 {
     Token varname = null;
     String func = null;
     ArrayList parms = new ArrayList();
     Token bind = null;
     Token val = null;
     varname = mcc_consume_token(BIND2);
     mcc_consume_token(LBRACE);
     func = functionName();
     bind = mcc_consume_token(BIND);
     actionParams(parms);
     mcc_consume_token(RBRACE);
     PredicateConstraint predc = new PredicateConstraint();
     predc.Name = identifier.image;
     predc.VariableName = varname.image.Substring(1, varname.image.Length - 2);
     predc.FunctionName = func;
     BoundParam bp = new BoundParam();
     bp.VariableName = bind.image;
     predc.addParameter(bp);
     predc.addParameters(parms);
     list.Add(predc);
 }
コード例 #12
0
 /* arrayType handles multislot tokens */
 public void arrayType(ArrayList tokens)
 {
     Token tval;
     Object val;
     switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
     {
         case IDENTIFIER:
             tval = mcc_consume_token(IDENTIFIER);
             tokens.Add(tval.image);
             break;
         case BIND:
             tval = mcc_consume_token(BIND);
             if (tval.kind == BIND)
             {
                 BoundParam bp = new BoundParam();
                 bp.VariableName = tval.image;
                 tokens.Add(bp);
             }
             break;
         case BIND3:
             tval = mcc_consume_token(BIND3);
             if (tval.kind == BIND3)
             {
                 BoundParam bp = new BoundParam();
                 bp.VariableName = tval.image;
                 tokens.Add(bp);
             }
             break;
         case INTEGER_LITERAL:
         case FLOATING_POINT_LITERAL:
         case STRING_LITERAL:
         case PATH_LITERAL:
             val = typeExpr();
             tokens.Add(val);
             break;
         default:
             mcc_la1[29] = mcc_gen;
             mcc_consume_token(-1);
             throw new ParseException();
     }
 }
コード例 #13
0
 public Object slotValueType()
 {
     Object body;
     Token btoken;
     bool boolval;
     switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
     {
         case BIND:
         case BIND3:
         case BIND4:
             btoken = getBindType();
             // probably should refactor this later, instead of looking up the value directly
             Object val = engine.getDefglobalValue(btoken.image);
             if (val != null)
             {
                 {
                     if (true) return engine.getDefglobalValue(btoken.image);
                 }
             }
             else
             {
                 BoundParam bp = new BoundParam();
                 bp.VariableName = btoken.image;
                 {
                     if (true) return bp;
                 }
             }
             break;
         case INTEGER_LITERAL:
         case FLOATING_POINT_LITERAL:
         case STRING_LITERAL:
         case PATH_LITERAL:
             body = typeExpr();
             {
                 if (true) return body;
             }
             break;
         case TRUE:
         case TRUE2:
         case FALSE:
         case FALSE2:
             boolval = trueFalse();
             {
                 if (true) return Convert.ToBoolean(boolval);
             }
             break;
         case IDENTIFIER:
             btoken = mcc_consume_token(IDENTIFIER);
             {
                 if (true) return btoken.image;
             }
             break;
         default:
             mcc_la1[28] = mcc_gen;
             mcc_consume_token(-1);
             throw new ParseException();
     }
     throw new Exception("Missing return statement in function");
 }
コード例 #14
0
 /// <summary> bindingParams is meant to parse the params for a deffunction
 /// </summary>
 public void bindingParams(IList list)
 {
     Object exp;
     Token tok;
     ValueParam vp = null;
     tok = BindType;
     BoundParam bp = new BoundParam();
     if (tok.kind == CLIPSParserConstants_Fields.BIND4)
     {
         bp.VariableName = tok.image.Substring(2);
         bp.IsMultislot = true;
     }
     else
     {
         bp.VariableName = tok.image;
     }
     list.Add(bp);
 }
コード例 #15
0
        /* arrayType handles multislot tokens */
        public void arrayType(IList tokens)
        {
            Token tval;
            Object val;
            switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
            {
                case CLIPSParserConstants_Fields.IDENTIFIER:
                    tval = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                    tokens.Add(tval.image);
                    break;

                case CLIPSParserConstants_Fields.BIND:
                    tval = jj_consume_token(CLIPSParserConstants_Fields.BIND);
                    if (tval.kind == CLIPSParserConstants_Fields.BIND)
                    {
                        BoundParam bp = new BoundParam();
                        bp.VariableName = tval.image;
                        tokens.Add(bp);
                    }
                    break;

                case CLIPSParserConstants_Fields.BIND3:
                    tval = jj_consume_token(CLIPSParserConstants_Fields.BIND3);
                    if (tval.kind == CLIPSParserConstants_Fields.BIND3)
                    {
                        BoundParam bp = new BoundParam();
                        bp.VariableName = tval.image;
                        tokens.Add(bp);
                    }
                    break;

                case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                case CLIPSParserConstants_Fields.FLOATING_POINT_LITERAL:
                case CLIPSParserConstants_Fields.STRING_LITERAL:
                case CLIPSParserConstants_Fields.PATH_LITERAL:
                    val = typeExpr();
                    tokens.Add(val);
                    break;

                default:
                    jj_la1[29] = jj_gen;
                    jj_consume_token(- 1);
                    throw new ParseException();
            }
        }
コード例 #16
0
        public void valueParams(IList list)
        {
            Object exp;
            Token tok;
            ValueParam vp = null;
            if (jj_2_1(2147483647))
            {
                jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                exp = expr();
                jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                ShellFunction subfunc = (ShellFunction) exp;
                FunctionParam2 fp2 = new FunctionParam2();
                fp2.FunctionName = subfunc.Name;
                fp2.Engine = engine;
                fp2.Parameters = subfunc.Parameters;
                list.Add(fp2);
            }
            else
            {
                switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                {
                    case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                    case CLIPSParserConstants_Fields.FLOATING_POINT_LITERAL:
                    case CLIPSParserConstants_Fields.STRING_LITERAL:
                    case CLIPSParserConstants_Fields.PATH_LITERAL:
                        exp = typeExpr();
                        vp = new ValueParam();
                        vp.Value = exp;
                        if (exp is Decimal)
                        {
                            vp.ValueType = Constants.BIG_DECIMAL;
                        }
                        else if (exp is String)
                        {
                            vp.ValueType = Constants.STRING_TYPE;
                        }
                        list.Add(vp);
                        break;

                    case CLIPSParserConstants_Fields.IDENTIFIER:
                        exp = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                        vp = new ValueParam();
                        vp.ValueType = Constants.STRING_TYPE;
                        if (exp is Token)
                        {
                            vp.Value = ((Token) exp).image;
                        }
                        else
                        {
                            vp.Value = exp;
                        }
                        list.Add(vp);
                        break;

                    case CLIPSParserConstants_Fields.TRUE:
                        exp = jj_consume_token(CLIPSParserConstants_Fields.TRUE);
                        vp = new ValueParam();
                        vp.Value = true;
                        list.Add(vp);
                        break;

                    case CLIPSParserConstants_Fields.TRUE2:
                        exp = jj_consume_token(CLIPSParserConstants_Fields.TRUE2);
                        vp = new ValueParam();
                        vp.Value = true;
                        list.Add(vp);
                        break;

                    case CLIPSParserConstants_Fields.FALSE:
                        exp = jj_consume_token(CLIPSParserConstants_Fields.FALSE);
                        vp = new ValueParam();
                        vp.Value = false;
                        list.Add(vp);
                        break;

                    case CLIPSParserConstants_Fields.FALSE2:
                        exp = jj_consume_token(CLIPSParserConstants_Fields.FALSE2);
                        vp = new ValueParam();
                        vp.Value = false;
                        list.Add(vp);
                        break;

                    case CLIPSParserConstants_Fields.BIND:
                    case CLIPSParserConstants_Fields.BIND3:
                    case CLIPSParserConstants_Fields.BIND4:
                        tok = BindType;
                        BoundParam bp = new BoundParam();
                        if (tok.kind == CLIPSParserConstants_Fields.BIND4)
                        {
                            bp.VariableName = tok.image.Substring(2);
                            bp.IsMultislot = true;
                        }
                        else
                        {
                            bp.VariableName = tok.image;
                        }
                        list.Add(bp);
                        break;

                    default:
                        jj_la1[17] = jj_gen;
                        jj_consume_token(- 1);
                        throw new ParseException();
                }
            }
        }
コード例 #17
0
        public Object slotValueType()
        {
            Object body;
            Token btoken;
            bool boolval;
            switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
            {
                case CLIPSParserConstants_Fields.BIND:
                case CLIPSParserConstants_Fields.BIND3:
                case CLIPSParserConstants_Fields.BIND4:
                    btoken = BindType;
                    // probably should refactor this later, instead of looking up the value directly
                    Object val = engine.getDefglobalValue(btoken.image);
                    if (val != null)
                    {
                        {
                            if (true)
                                return engine.getDefglobalValue(btoken.image);
                        }
                    }
                    else
                    {
                        BoundParam bp = new BoundParam();
                        bp.VariableName = btoken.image;
                        {
                            if (true)
                                return bp;
                        }
                    }
                    break;

                case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                case CLIPSParserConstants_Fields.FLOATING_POINT_LITERAL:
                case CLIPSParserConstants_Fields.STRING_LITERAL:
                case CLIPSParserConstants_Fields.PATH_LITERAL:
                    body = typeExpr();
                    {
                        if (true)
                            return body;
                    }
                    break;

                case CLIPSParserConstants_Fields.TRUE:
                case CLIPSParserConstants_Fields.TRUE2:
                case CLIPSParserConstants_Fields.FALSE:
                case CLIPSParserConstants_Fields.FALSE2:
                    boolval = trueFalse();
                    {
                        if (true)
                            return boolval;
                    }
                    break;

                case CLIPSParserConstants_Fields.IDENTIFIER:
                    btoken = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                    {
                        if (true)
                            return btoken.image;
                    }
                    break;

                default:
                    jj_la1[28] = jj_gen;
                    jj_consume_token(- 1);
                    throw new ParseException();
            }
            throw new ApplicationException("Missing return statement in function");
        }
コード例 #18
0
        public Object expr()
        {
            Token exp = null;
            Token exp2 = null;
            Token exp3 = null;
            String body;
            ValueParam param;
            Deffact fact;
            Deftemplate templ;
            Defrule rule;
            ShellFunction func;
            DeffunctionFunction dffunc;
            ArrayList list = new ArrayList();
            ValueParam[] pms;
            ArrayList infunc = new ArrayList();
            switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
            {
                case ASSERT:
                    exp = mcc_consume_token(ASSERT);
                    mcc_consume_token(LBRACE);
                    exp2 = mcc_consume_token(IDENTIFIER);
                    while (true)
                    {
                        assertContents(list);
                        switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                        {
                            case LBRACE:
                                ;
                                break;
                            default:
                                mcc_la1[3] = mcc_gen;
                                goto label_2;
                        }
                    }
                    label_2:
                    ;

                    mcc_consume_token(RBRACE);
                    func = new ShellFunction();
                    func.Name = exp.image;
                    pms = new ValueParam[2];
                    pms[0] = new ValueParam(Constants.STRING_TYPE, exp2.image);
                    pms[1] = new ValueParam(Constants.OBJECT_TYPE, list.ToArray());
                    func.setParameters(pms);
                    exp.Clear();
                    exp = null;
                    {
                        if (true) return func;
                    }
                    break;
                case ASSERTTEMPORAL:
                    exp = mcc_consume_token(ASSERTTEMPORAL);
                    mcc_consume_token(LBRACE);
                    exp2 = mcc_consume_token(IDENTIFIER);
                    while (true)
                    {
                        assertContents(list);
                        switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                        {
                            case LBRACE:
                                ;
                                break;
                            default:
                                mcc_la1[4] = mcc_gen;
                                goto label_3;
                        }
                    }
                    label_3:
                    ;

                    mcc_consume_token(RBRACE);
                    func = new ShellFunction();
                    func.Name = exp.image;
                    pms = new ValueParam[2];
                    pms[0] = new ValueParam(Constants.STRING_TYPE, exp2.image);
                    pms[1] = new ValueParam(Constants.OBJECT_TYPE, list.ToArray());
                    func.setParameters(pms);
                    exp.Clear();
                    exp = null;
                    {
                        if (true) return func;
                    }
                    break;
                case RETRACT:
                    exp = mcc_consume_token(RETRACT);
                    switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                    {
                        case BIND:
                            exp2 = mcc_consume_token(BIND);
                            break;
                        case INTEGER_LITERAL:
                            exp2 = mcc_consume_token(INTEGER_LITERAL);
                            break;
                        default:
                            mcc_la1[5] = mcc_gen;
                            mcc_consume_token(-1);
                            throw new ParseException();
                    }
                    func = new ShellFunction();
                    func.Name = exp.image;
                    IParameter[] rpms = new IParameter[1];
                    if (exp2.image.StartsWith("?"))
                    {
                        BoundParam bp1 = new BoundParam();
                        bp1.VariableName = exp2.image;
                        rpms[0] = bp1;
                    }
                    else
                    {
                        ValueParam vp = new ValueParam(Constants.BIG_DECIMAL, Convert.ToDecimal(exp2.image));
                        rpms[0] = vp;
                    }
                    func.setParameters(rpms);
                    exp.Clear();
                    exp = null;
                    exp2.Clear();
                    exp2 = null;
                    {
                        if (true) return func;
                    }
                    break;
                case MODIFY:
                    exp = mcc_consume_token(MODIFY);
                    exp2 = mcc_consume_token(BIND);
                    assertContents(list);
                    func = new ShellFunction();
                    func.Name = exp.image;
                    BoundParam bp = new BoundParam();
                    bp.VariableName = exp2.image;
                    list.Insert(0, bp);
                    func.setParameters(ParameterUtils.slotToParameters(list));
                    exp.Clear();
                    exp = null;
                    {
                        if (true) return func;
                    }
                    break;
                case DEFTEMPLATE:
                    exp = mcc_consume_token(DEFTEMPLATE);
                    templ = templateExpr();
                    func = new ShellFunction();
                    func.Name = exp.image;
                    pms = new ValueParam[1];
                    pms[0] = new ValueParam(Constants.OBJECT_TYPE, templ);
                    func.setParameters(pms);
                    {
                        if (true) return func;
                    }
                    break;
                case DEFMODULE:
                    exp = mcc_consume_token(DEFMODULE);
                    body = getIdentifier();
                    func = new ShellFunction();
                    func.Name = exp.image;
                    pms = new ValueParam[1];
                    pms[0] = new ValueParam(Constants.STRING_TYPE, body);
                    func.setParameters(pms);
                    {
                        if (true) return func;
                    }
                    break;
                case DEFRULE:
                    exp = mcc_consume_token(DEFRULE);
                    rule = ruleBody();
                    func = new ShellFunction();
                    func.Name = exp.image;
                    pms = new ValueParam[1];
                    pms[0] = new ValueParam(Constants.OBJECT_TYPE, rule);
                    func.setParameters(pms);
                    {
                        if (true) return func;
                    }
                    break;
                case DEFCLASS:
                    exp = mcc_consume_token(DEFCLASS);
                    switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                    {
                        case LBRACE:
                        case INTEGER_LITERAL:
                        case FLOATING_POINT_LITERAL:
                        case STRING_LITERAL:
                        case BIND:
                        case BIND3:
                        case BIND4:
                        case TRUE:
                        case TRUE2:
                        case FALSE:
                        case FALSE2:
                        case IDENTIFIER:
                        case PATH_LITERAL:
                            while (true)
                            {
                                valueParams(list);
                                switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                                {
                                    case LBRACE:
                                    case INTEGER_LITERAL:
                                    case FLOATING_POINT_LITERAL:
                                    case STRING_LITERAL:
                                    case BIND:
                                    case BIND3:
                                    case BIND4:
                                    case TRUE:
                                    case TRUE2:
                                    case FALSE:
                                    case FALSE2:
                                    case IDENTIFIER:
                                    case PATH_LITERAL:
                                        ;
                                        break;
                                    default:
                                        mcc_la1[6] = mcc_gen;
                                        goto label_4;
                                }
                            }
                            label_4:
                            ;

                            break;
                        default:
                            mcc_la1[7] = mcc_gen;
                            ;
                            break;
                    }
                    func = new ShellFunction();
                    func.Name = exp.image;
                    func.setParameters(ParameterUtils.convertParameters(list));
                    list.Clear();
                    {
                        if (true) return func;
                    }
                    break;
                case DEFFUNCTION:
                    exp = mcc_consume_token(DEFFUNCTION);
                    exp2 = mcc_consume_token(IDENTIFIER);
                    mcc_consume_token(LBRACE);
                    switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                    {
                        case BIND:
                        case BIND3:
                        case BIND4:
                            while (true)
                            {
                                bindingParams(list);
                                switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                                {
                                    case BIND:
                                    case BIND3:
                                    case BIND4:
                                        ;
                                        break;
                                    default:
                                        mcc_la1[8] = mcc_gen;
                                        goto label_5;
                                }
                            }
                            label_5:
                            ;

                            break;
                        default:
                            mcc_la1[9] = mcc_gen;
                            ;
                            break;
                    }
                    mcc_consume_token(RBRACE);
                    mcc_consume_token(LBRACE);
                    switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                    {
                        case BINDING:
                        case ASSERT:
                        case ASSERTTEMPORAL:
                        case DEFCLASS:
                        case DEFFUNCTION:
                        case DEFMODULE:
                        case DEFRULE:
                        case DEFTEMPLATE:
                        case MODIFY:
                        case RETRACT:
                        case PLUS:
                        case MINUS:
                        case MULTIPLY:
                        case DIVIDE:
                        case GT1:
                        case GT2:
                        case LT1:
                        case LT2:
                        case EQ1:
                        case EQ2:
                        case LE1:
                        case LE2:
                        case GE1:
                        case GE2:
                        case IDENTIFIER:
                            ruleAction(infunc);
                            break;
                        default:
                            mcc_la1[10] = mcc_gen;
                            ;
                            break;
                    }
                    mcc_consume_token(RBRACE);
                    dffunc = new DeffunctionFunction();
                    dffunc.Name = exp2.image;
                    dffunc.setParameters(ParameterUtils.convertParameters(list));
                    dffunc.Function = (infunc);
                    list.Clear();
                    {
                        if (true) return dffunc;
                    }
                    break;
                case BINDING:
                    mcc_consume_token(BINDING);
                    exp = getBindType();
                    while (true)
                    {
                        valueParams(list);
                        switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                        {
                            case LBRACE:
                            case INTEGER_LITERAL:
                            case FLOATING_POINT_LITERAL:
                            case STRING_LITERAL:
                            case BIND:
                            case BIND3:
                            case BIND4:
                            case TRUE:
                            case TRUE2:
                            case FALSE:
                            case FALSE2:
                            case IDENTIFIER:
                            case PATH_LITERAL:
                                ;
                                break;
                            default:
                                mcc_la1[11] = mcc_gen;
                                goto label_6;
                        }
                    }
                    label_6:
                    ;

                    func = new ShellFunction();
                    func.Name = "bind";
                    list.Insert(0, new ValueParam(Constants.STRING_TYPE, exp.image.Substring(1)));
                    func.setParameters(ParameterUtils.convertParameters(list));
                    list.Clear();
                    {
                        if (true) return func;
                    }
                    break;
                case PLUS:
                case MINUS:
                case MULTIPLY:
                case DIVIDE:
                case GT1:
                case GT2:
                case LT1:
                case LT2:
                case EQ1:
                case EQ2:
                case LE1:
                case LE2:
                case GE1:
                case GE2:
                    switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                    {
                        case PLUS:
                            exp = mcc_consume_token(PLUS);
                            break;
                        case MINUS:
                            exp = mcc_consume_token(MINUS);
                            break;
                        case MULTIPLY:
                            exp = mcc_consume_token(MULTIPLY);
                            break;
                        case DIVIDE:
                            exp = mcc_consume_token(DIVIDE);
                            break;
                        case GT1:
                            exp = mcc_consume_token(GT1);
                            break;
                        case GT2:
                            exp = mcc_consume_token(GT2);
                            break;
                        case LT1:
                            exp = mcc_consume_token(LT1);
                            break;
                        case LT2:
                            exp = mcc_consume_token(LT2);
                            break;
                        case EQ1:
                            exp = mcc_consume_token(EQ1);
                            break;
                        case EQ2:
                            exp = mcc_consume_token(EQ2);
                            break;
                        case LE1:
                            exp = mcc_consume_token(LE1);
                            break;
                        case LE2:
                            exp = mcc_consume_token(LE2);
                            break;
                        case GE1:
                            exp = mcc_consume_token(GE1);
                            break;
                        case GE2:
                            exp = mcc_consume_token(GE2);
                            break;
                        default:
                            mcc_la1[12] = mcc_gen;
                            mcc_consume_token(-1);
                            throw new ParseException();
                    }
                    while (true)
                    {
                        valueParams(list);
                        switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                        {
                            case LBRACE:
                            case INTEGER_LITERAL:
                            case FLOATING_POINT_LITERAL:
                            case STRING_LITERAL:
                            case BIND:
                            case BIND3:
                            case BIND4:
                            case TRUE:
                            case TRUE2:
                            case FALSE:
                            case FALSE2:
                            case IDENTIFIER:
                            case PATH_LITERAL:
                                ;
                                break;
                            default:
                                mcc_la1[13] = mcc_gen;
                                goto label_7;
                        }
                    }
                    label_7:
                    ;

                    func = new ShellFunction();
                    func.Name = exp.image;
                    func.setParameters(ParameterUtils.convertParameters(list));
                    list.Clear();
                    {
                        if (true) return func;
                    }
                    break;
                case IDENTIFIER:
                    exp = mcc_consume_token(IDENTIFIER);
                    switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                    {
                        case LBRACE:
                        case INTEGER_LITERAL:
                        case FLOATING_POINT_LITERAL:
                        case STRING_LITERAL:
                        case BIND:
                        case BIND3:
                        case BIND4:
                        case TRUE:
                        case TRUE2:
                        case FALSE:
                        case FALSE2:
                        case IDENTIFIER:
                        case PATH_LITERAL:
                            while (true)
                            {
                                valueParams(list);
                                switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                                {
                                    case LBRACE:
                                    case INTEGER_LITERAL:
                                    case FLOATING_POINT_LITERAL:
                                    case STRING_LITERAL:
                                    case BIND:
                                    case BIND3:
                                    case BIND4:
                                    case TRUE:
                                    case TRUE2:
                                    case FALSE:
                                    case FALSE2:
                                    case IDENTIFIER:
                                    case PATH_LITERAL:
                                        ;
                                        break;
                                    default:
                                        mcc_la1[14] = mcc_gen;
                                        goto label_8;
                                }
                            }
                            label_8:
                            ;

                            break;
                        default:
                            mcc_la1[15] = mcc_gen;
                            ;
                            break;
                    }
                    func = new ShellFunction();
                    func.Name = exp.image;
                    func.setParameters(ParameterUtils.convertParameters(list));
                    list.Clear();
                    {
                        if (true) return func;
                    }
                    break;
                default:
                    mcc_la1[16] = mcc_gen;
                    mcc_consume_token(-1);
                    throw new ParseException();
            }
            throw new Exception("Missing return statement in function");
        }
コード例 #19
0
 public void predicateFunc(IList list, Token identifier)
 {
     Token varname = null;
     String func = null;
     IList params_Renamed = new ArrayList();
     Token bind = null;
     Token val = null;
     varname = jj_consume_token(CLIPSParserConstants_Fields.BIND2);
     jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
     func = functionName();
     bind = jj_consume_token(CLIPSParserConstants_Fields.BIND);
     actionParams(params_Renamed);
     jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
     PredicateConstraint predc = new PredicateConstraint();
     predc.Name = identifier.image;
     predc.VariableName = varname.image.Substring(1, (varname.image.Length - 2) - (1));
     predc.FunctionName = func;
     BoundParam bp = new BoundParam();
     bp.VariableName = bind.image;
     predc.addParameter(bp);
     predc.addParameters(params_Renamed);
     list.Add(predc);
 }
コード例 #20
0
        public Object expr()
        {
            Token exp = null;
            Token exp2 = null;
            Token exp3 = null;
            String body;
            ValueParam param;
            Deffact fact;
            Deftemplate templ;
            Defrule rule;
            ShellFunction func;
            DeffunctionFunction dffunc;
            ArrayList list = new ArrayList();
            ValueParam[] pms;
            IList infunc = new ArrayList();
            switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
            {
                case CLIPSParserConstants_Fields.ASSERT:
                    exp = jj_consume_token(CLIPSParserConstants_Fields.ASSERT);
                    jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                    exp2 = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                    while (true)
                    {
                        assertContents(list);
                        switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                        {
                            case CLIPSParserConstants_Fields.LBRACE:
                                ;
                                break;

                            default:
                                jj_la1[3] = jj_gen;
                                //UPGRADE_NOTE: Labeled break statement was changed to a goto statement. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1012"'
                                goto label_2_brk;
                        }
                    }
                    //UPGRADE_NOTE: Label 'label_2_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                    label_2_brk:
                    ;

                    jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                    func = new ShellFunction();
                    func.Name = exp.image;
                    pms = new ValueParam[2];
                    pms[0] = new ValueParam(Constants.STRING_TYPE, exp2.image);

                    object[] lst = new object[list.Count];
                    list.CopyTo(lst, 0);

                    pms[1] = new ValueParam(Constants.OBJECT_TYPE, lst);
                    func.setParameters(pms);
                    exp.clear();
                    exp = null;
                    {
                        if (true)
                            return func;
                    }
                    break;

                case CLIPSParserConstants_Fields.ASSERTTEMPORAL:
                    exp = jj_consume_token(CLIPSParserConstants_Fields.ASSERTTEMPORAL);
                    jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                    exp2 = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                    while (true)
                    {
                        assertContents(list);
                        switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                        {
                            case CLIPSParserConstants_Fields.LBRACE:
                                ;
                                break;

                            default:
                                jj_la1[4] = jj_gen;
                                //UPGRADE_NOTE: Labeled break statement was changed to a goto statement. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1012"'
                                goto label_3_brk;
                        }
                    }
                    //UPGRADE_NOTE: Label 'label_3_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                    label_3_brk:
                    ;

                    jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                    func = new ShellFunction();
                    func.Name = exp.image;
                    pms = new ValueParam[2];
                    pms[0] = new ValueParam(Constants.STRING_TYPE, exp2.image);

                    object[] lst1 = new object[list.Count];
                    list.CopyTo(lst1,0);
                    pms[1] = new ValueParam(Constants.OBJECT_TYPE, lst1);
                    func.setParameters(pms);
                    exp.clear();
                    exp = null;
                    {
                        if (true)
                            return func;
                    }
                    break;

                case CLIPSParserConstants_Fields.RETRACT:
                    exp = jj_consume_token(CLIPSParserConstants_Fields.RETRACT);
                    switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                    {
                        case CLIPSParserConstants_Fields.BIND:
                            exp2 = jj_consume_token(CLIPSParserConstants_Fields.BIND);
                            break;

                        case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                            exp2 = jj_consume_token(CLIPSParserConstants_Fields.INTEGER_LITERAL);
                            break;

                        default:
                            jj_la1[5] = jj_gen;
                            jj_consume_token(- 1);
                            throw new ParseException();
                    }
                    func = new ShellFunction();
                    func.Name = exp.image;
                    IParameter[] rpms = new IParameter[1];
                    if (exp2.image.StartsWith("?"))
                    {
                        BoundParam bp = new BoundParam();
                        bp.VariableName = exp2.image;
                        rpms[0] = bp;
                    }
                    else
                    {
                        ValueParam vp = new ValueParam(Constants.BIG_DECIMAL, Decimal.Parse(exp2.image));
                        rpms[0] = vp;
                    }
                    func.Parameters = rpms;
                    exp.clear();
                    exp = null;
                    exp2.clear();
                    exp2 = null;
                    {
                        if (true)
                            return func;
                    }
                    break;

                case CLIPSParserConstants_Fields.MODIFY:
                    exp = jj_consume_token(CLIPSParserConstants_Fields.MODIFY);
                    exp2 = jj_consume_token(CLIPSParserConstants_Fields.BIND);
                    assertContents(list);
                    func = new ShellFunction();
                    func.Name = exp.image;
                    BoundParam bp1 = new BoundParam();
                    bp1.VariableName = exp2.image;
                    list.Insert(0, bp1);
                    func.setParameters(ParameterUtils.slotToParameters(list));
                    exp.clear();
                    exp = null;
                    {
                        if (true)
                            return func;
                    }
                    break;

                case CLIPSParserConstants_Fields.DEFTEMPLATE:
                    exp = jj_consume_token(CLIPSParserConstants_Fields.DEFTEMPLATE);
                    templ = templateExpr();
                    func = new ShellFunction();
                    func.Name = exp.image;
                    pms = new ValueParam[1];
                    pms[0] = new ValueParam(Constants.OBJECT_TYPE, templ);
                    func.setParameters(pms);
                    {
                        if (true)
                            return func;
                    }
                    break;

                case CLIPSParserConstants_Fields.DEFMODULE:
                    exp = jj_consume_token(CLIPSParserConstants_Fields.DEFMODULE);
                    body = Identifier;
                    func = new ShellFunction();
                    func.Name = exp.image;
                    pms = new ValueParam[1];
                    pms[0] = new ValueParam(Constants.STRING_TYPE, body);
                    func.setParameters(pms);
                    {
                        if (true)
                            return func;
                    }
                    break;

                case CLIPSParserConstants_Fields.DEFRULE:
                    exp = jj_consume_token(CLIPSParserConstants_Fields.DEFRULE);
                    rule = ruleBody();
                    func = new ShellFunction();
                    func.Name = exp.image;
                    pms = new ValueParam[1];
                    pms[0] = new ValueParam(Constants.OBJECT_TYPE, rule);
                    func.setParameters(pms);
                    {
                        if (true)
                            return func;
                    }
                    break;

                case CLIPSParserConstants_Fields.DEFCLASS:
                    exp = jj_consume_token(CLIPSParserConstants_Fields.DEFCLASS);
                    switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                    {
                        case CLIPSParserConstants_Fields.LBRACE:
                        case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                        case CLIPSParserConstants_Fields.FLOATING_POINT_LITERAL:
                        case CLIPSParserConstants_Fields.STRING_LITERAL:
                        case CLIPSParserConstants_Fields.BIND:
                        case CLIPSParserConstants_Fields.BIND3:
                        case CLIPSParserConstants_Fields.BIND4:
                        case CLIPSParserConstants_Fields.TRUE:
                        case CLIPSParserConstants_Fields.TRUE2:
                        case CLIPSParserConstants_Fields.FALSE:
                        case CLIPSParserConstants_Fields.FALSE2:
                        case CLIPSParserConstants_Fields.IDENTIFIER:
                        case CLIPSParserConstants_Fields.PATH_LITERAL:
                            while (true)
                            {
                                valueParams(list);
                                switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                                {
                                    case CLIPSParserConstants_Fields.LBRACE:
                                    case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                                    case CLIPSParserConstants_Fields.FLOATING_POINT_LITERAL:
                                    case CLIPSParserConstants_Fields.STRING_LITERAL:
                                    case CLIPSParserConstants_Fields.BIND:
                                    case CLIPSParserConstants_Fields.BIND3:
                                    case CLIPSParserConstants_Fields.BIND4:
                                    case CLIPSParserConstants_Fields.TRUE:
                                    case CLIPSParserConstants_Fields.TRUE2:
                                    case CLIPSParserConstants_Fields.FALSE:
                                    case CLIPSParserConstants_Fields.FALSE2:
                                    case CLIPSParserConstants_Fields.IDENTIFIER:
                                    case CLIPSParserConstants_Fields.PATH_LITERAL:
                                        ;
                                        break;

                                    default:
                                        jj_la1[6] = jj_gen;
                                        //UPGRADE_NOTE: Labeled break statement was changed to a goto statement. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1012"'
                                        goto label_4_brk;
                                }
                            }
                            //UPGRADE_NOTE: Label 'label_4_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                            label_4_brk:
                            ;

                            break;

                        default:
                            jj_la1[7] = jj_gen;
                            ;
                            break;
                    }
                    func = new ShellFunction();
                    func.Name = exp.image;
                    func.setParameters(ParameterUtils.convertParameters(list));
                    list.Clear();
                    {
                        if (true)
                            return func;
                    }
                    break;

                case CLIPSParserConstants_Fields.DEFFUNCTION:
                    exp = jj_consume_token(CLIPSParserConstants_Fields.DEFFUNCTION);
                    exp2 = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                    jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                    switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                    {
                        case CLIPSParserConstants_Fields.BIND:
                        case CLIPSParserConstants_Fields.BIND3:
                        case CLIPSParserConstants_Fields.BIND4:
                            while (true)
                            {
                                bindingParams(list);
                                switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                                {
                                    case CLIPSParserConstants_Fields.BIND:
                                    case CLIPSParserConstants_Fields.BIND3:
                                    case CLIPSParserConstants_Fields.BIND4:
                                        ;
                                        break;

                                    default:
                                        jj_la1[8] = jj_gen;
                                        //UPGRADE_NOTE: Labeled break statement was changed to a goto statement. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1012"'
                                        goto label_5_brk;
                                }
                            }
                            //UPGRADE_NOTE: Label 'label_5_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                            label_5_brk:
                            ;

                            break;

                        default:
                            jj_la1[9] = jj_gen;
                            ;
                            break;
                    }
                    jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                    jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                    switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                    {
                        case CLIPSParserConstants_Fields.BINDING:
                        case CLIPSParserConstants_Fields.ASSERT:
                        case CLIPSParserConstants_Fields.ASSERTTEMPORAL:
                        case CLIPSParserConstants_Fields.DEFCLASS:
                        case CLIPSParserConstants_Fields.DEFFUNCTION:
                        case CLIPSParserConstants_Fields.DEFMODULE:
                        case CLIPSParserConstants_Fields.DEFRULE:
                        case CLIPSParserConstants_Fields.DEFTEMPLATE:
                        case CLIPSParserConstants_Fields.MODIFY:
                        case CLIPSParserConstants_Fields.RETRACT:
                        case CLIPSParserConstants_Fields.PLUS:
                        case CLIPSParserConstants_Fields.MINUS:
                        case CLIPSParserConstants_Fields.MULTIPLY:
                        case CLIPSParserConstants_Fields.DIVIDE:
                        case CLIPSParserConstants_Fields.GT1:
                        case CLIPSParserConstants_Fields.GT2:
                        case CLIPSParserConstants_Fields.LT1:
                        case CLIPSParserConstants_Fields.LT2:
                        case CLIPSParserConstants_Fields.EQ1:
                        case CLIPSParserConstants_Fields.EQ2:
                        case CLIPSParserConstants_Fields.LE1:
                        case CLIPSParserConstants_Fields.LE2:
                        case CLIPSParserConstants_Fields.GE1:
                        case CLIPSParserConstants_Fields.GE2:
                        case CLIPSParserConstants_Fields.IDENTIFIER:
                            ruleAction(infunc);
                            break;

                        default:
                            jj_la1[10] = jj_gen;
                            ;
                            break;
                    }
                    jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                    dffunc = new DeffunctionFunction();
                    dffunc.Name = exp2.image;
                    dffunc.setParameters(ParameterUtils.convertParameters(list));
                    dffunc.setFunction(infunc);
                    list.Clear();
                    {
                        if (true)
                            return dffunc;
                    }
                    break;

                case CLIPSParserConstants_Fields.BINDING:
                    jj_consume_token(CLIPSParserConstants_Fields.BINDING);
                    exp = BindType;
                    while (true)
                    {
                        valueParams(list);
                        switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                        {
                            case CLIPSParserConstants_Fields.LBRACE:
                            case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                            case CLIPSParserConstants_Fields.FLOATING_POINT_LITERAL:
                            case CLIPSParserConstants_Fields.STRING_LITERAL:
                            case CLIPSParserConstants_Fields.BIND:
                            case CLIPSParserConstants_Fields.BIND3:
                            case CLIPSParserConstants_Fields.BIND4:
                            case CLIPSParserConstants_Fields.TRUE:
                            case CLIPSParserConstants_Fields.TRUE2:
                            case CLIPSParserConstants_Fields.FALSE:
                            case CLIPSParserConstants_Fields.FALSE2:
                            case CLIPSParserConstants_Fields.IDENTIFIER:
                            case CLIPSParserConstants_Fields.PATH_LITERAL:
                                ;
                                break;

                            default:
                                jj_la1[11] = jj_gen;
                                //UPGRADE_NOTE: Labeled break statement was changed to a goto statement. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1012"'
                                goto label_6_brk;
                        }
                    }
                    //UPGRADE_NOTE: Label 'label_6_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                    label_6_brk:
                    ;

                    func = new ShellFunction();
                    func.Name = "bind";
                    list.Insert(0, new ValueParam(Constants.STRING_TYPE, exp.image.Substring(1)));
                    func.setParameters(ParameterUtils.convertParameters(list));
                    list.Clear();
                    {
                        if (true)
                            return func;
                    }
                    break;

                case CLIPSParserConstants_Fields.PLUS:
                case CLIPSParserConstants_Fields.MINUS:
                case CLIPSParserConstants_Fields.MULTIPLY:
                case CLIPSParserConstants_Fields.DIVIDE:
                case CLIPSParserConstants_Fields.GT1:
                case CLIPSParserConstants_Fields.GT2:
                case CLIPSParserConstants_Fields.LT1:
                case CLIPSParserConstants_Fields.LT2:
                case CLIPSParserConstants_Fields.EQ1:
                case CLIPSParserConstants_Fields.EQ2:
                case CLIPSParserConstants_Fields.LE1:
                case CLIPSParserConstants_Fields.LE2:
                case CLIPSParserConstants_Fields.GE1:
                case CLIPSParserConstants_Fields.GE2:
                    switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                    {
                        case CLIPSParserConstants_Fields.PLUS:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.PLUS);
                            break;

                        case CLIPSParserConstants_Fields.MINUS:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.MINUS);
                            break;

                        case CLIPSParserConstants_Fields.MULTIPLY:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.MULTIPLY);
                            break;

                        case CLIPSParserConstants_Fields.DIVIDE:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.DIVIDE);
                            break;

                        case CLIPSParserConstants_Fields.GT1:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.GT1);
                            break;

                        case CLIPSParserConstants_Fields.GT2:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.GT2);
                            break;

                        case CLIPSParserConstants_Fields.LT1:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.LT1);
                            break;

                        case CLIPSParserConstants_Fields.LT2:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.LT2);
                            break;

                        case CLIPSParserConstants_Fields.EQ1:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.EQ1);
                            break;

                        case CLIPSParserConstants_Fields.EQ2:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.EQ2);
                            break;

                        case CLIPSParserConstants_Fields.LE1:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.LE1);
                            break;

                        case CLIPSParserConstants_Fields.LE2:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.LE2);
                            break;

                        case CLIPSParserConstants_Fields.GE1:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.GE1);
                            break;

                        case CLIPSParserConstants_Fields.GE2:
                            exp = jj_consume_token(CLIPSParserConstants_Fields.GE2);
                            break;

                        default:
                            jj_la1[12] = jj_gen;
                            jj_consume_token(- 1);
                            throw new ParseException();
                    }
                    while (true)
                    {
                        valueParams(list);
                        switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                        {
                            case CLIPSParserConstants_Fields.LBRACE:
                            case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                            case CLIPSParserConstants_Fields.FLOATING_POINT_LITERAL:
                            case CLIPSParserConstants_Fields.STRING_LITERAL:
                            case CLIPSParserConstants_Fields.BIND:
                            case CLIPSParserConstants_Fields.BIND3:
                            case CLIPSParserConstants_Fields.BIND4:
                            case CLIPSParserConstants_Fields.TRUE:
                            case CLIPSParserConstants_Fields.TRUE2:
                            case CLIPSParserConstants_Fields.FALSE:
                            case CLIPSParserConstants_Fields.FALSE2:
                            case CLIPSParserConstants_Fields.IDENTIFIER:
                            case CLIPSParserConstants_Fields.PATH_LITERAL:
                                ;
                                break;

                            default:
                                jj_la1[13] = jj_gen;
                                //UPGRADE_NOTE: Labeled break statement was changed to a goto statement. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1012"'
                                goto label_7_brk;
                        }
                    }
                    //UPGRADE_NOTE: Label 'label_7_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                    label_7_brk:
                    ;

                    func = new ShellFunction();
                    func.Name = exp.image;
                    func.setParameters(ParameterUtils.convertParameters(list));
                    list.Clear();
                    {
                        if (true)
                            return func;
                    }
                    break;

                case CLIPSParserConstants_Fields.IDENTIFIER:
                    exp = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                    switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                    {
                        case CLIPSParserConstants_Fields.LBRACE:
                        case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                        case CLIPSParserConstants_Fields.FLOATING_POINT_LITERAL:
                        case CLIPSParserConstants_Fields.STRING_LITERAL:
                        case CLIPSParserConstants_Fields.BIND:
                        case CLIPSParserConstants_Fields.BIND3:
                        case CLIPSParserConstants_Fields.BIND4:
                        case CLIPSParserConstants_Fields.TRUE:
                        case CLIPSParserConstants_Fields.TRUE2:
                        case CLIPSParserConstants_Fields.FALSE:
                        case CLIPSParserConstants_Fields.FALSE2:
                        case CLIPSParserConstants_Fields.IDENTIFIER:
                        case CLIPSParserConstants_Fields.PATH_LITERAL:
                            while (true)
                            {
                                valueParams(list);
                                switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                                {
                                    case CLIPSParserConstants_Fields.LBRACE:
                                    case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                                    case CLIPSParserConstants_Fields.FLOATING_POINT_LITERAL:
                                    case CLIPSParserConstants_Fields.STRING_LITERAL:
                                    case CLIPSParserConstants_Fields.BIND:
                                    case CLIPSParserConstants_Fields.BIND3:
                                    case CLIPSParserConstants_Fields.BIND4:
                                    case CLIPSParserConstants_Fields.TRUE:
                                    case CLIPSParserConstants_Fields.TRUE2:
                                    case CLIPSParserConstants_Fields.FALSE:
                                    case CLIPSParserConstants_Fields.FALSE2:
                                    case CLIPSParserConstants_Fields.IDENTIFIER:
                                    case CLIPSParserConstants_Fields.PATH_LITERAL:
                                        ;
                                        break;

                                    default:
                                        jj_la1[14] = jj_gen;
                                        //UPGRADE_NOTE: Labeled break statement was changed to a goto statement. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1012"'
                                        goto label_8_brk;
                                }
                            }
                            //UPGRADE_NOTE: Label 'label_8_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                            label_8_brk:
                            ;

                            break;

                        default:
                            jj_la1[15] = jj_gen;
                            ;
                            break;
                    }
                    func = new ShellFunction();
                    func.Name = exp.image;
                    func.setParameters(ParameterUtils.convertParameters(list));
                    list.Clear();
                    {
                        if (true)
                            return func;
                    }
                    break;

                default:
                    jj_la1[16] = jj_gen;
                    jj_consume_token(- 1);
                    throw new ParseException();
            }
            throw new ApplicationException("Missing return statement in function");
        }
コード例 #21
0
 /**
  * bindingParams is meant to parse the params for a deffunction
  */
 public void bindingParams(ArrayList list)
 {
     Object exp;
     Token tok;
     ValueParam vp = null;
     tok = getBindType();
     BoundParam bp = new BoundParam();
     if (tok.kind == BIND4)
     {
         bp.VariableName = tok.image.Substring(2);
         bp.IsMultislot = true;
     }
     else
     {
         bp.VariableName = tok.image;
     }
     list.Add(bp);
 }
コード例 #22
0
 public void valueParams(ArrayList list)
 {
     Object exp;
     Token tok;
     ValueParam vp = null;
     if (mcc_2_1(2147483647))
     {
         mcc_consume_token(LBRACE);
         exp = expr();
         mcc_consume_token(RBRACE);
         ShellFunction subfunc = (ShellFunction) exp;
         FunctionParam2 fp2 = new FunctionParam2();
         fp2.FunctionName = subfunc.Name;
         fp2.Engine = engine;
         fp2.Parameters = subfunc.Parameters;
         list.Add(fp2);
     }
     else
     {
         switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
         {
             case INTEGER_LITERAL:
             case FLOATING_POINT_LITERAL:
             case STRING_LITERAL:
             case PATH_LITERAL:
                 exp = typeExpr();
                 vp = new ValueParam();
                 vp.Value = exp;
                 if (exp is Decimal)
                 {
                     vp.ValueType = Constants.BIG_DECIMAL;
                 }
                 else if (exp is String)
                 {
                     vp.ValueType = Constants.STRING_TYPE;
                 }
                 list.Add(vp);
                 break;
             case IDENTIFIER:
                 exp = mcc_consume_token(IDENTIFIER);
                 vp = new ValueParam();
                 vp.ValueType = Constants.STRING_TYPE;
                 if (exp is Token)
                 {
                     vp.Value = ((Token) exp).image;
                 }
                 else
                 {
                     vp.Value = exp;
                 }
                 list.Add(vp);
                 break;
             case TRUE:
                 exp = mcc_consume_token(TRUE);
                 vp = new ValueParam();
                 vp.Value = true;
                 list.Add(vp);
                 break;
             case TRUE2:
                 exp = mcc_consume_token(TRUE2);
                 vp = new ValueParam();
                 vp.Value = true;
                 list.Add(vp);
                 break;
             case FALSE:
                 exp = mcc_consume_token(FALSE);
                 vp = new ValueParam();
                 vp.Value = false;
                 list.Add(vp);
                 break;
             case FALSE2:
                 exp = mcc_consume_token(FALSE2);
                 vp = new ValueParam();
                 vp.Value = false;
                 list.Add(vp);
                 break;
             case BIND:
             case BIND3:
             case BIND4:
                 // in some cases, the parameters may be a binding to a variable
                 tok = getBindType();
                 BoundParam bp = new BoundParam();
                 if (tok.kind == BIND4)
                 {
                     bp.VariableName = tok.image.Substring(2);
                     bp.IsMultislot = true;
                 }
                 else
                 {
                     bp.VariableName = tok.image;
                 }
                 list.Add(bp);
                 break;
             default:
                 mcc_la1[17] = mcc_gen;
                 mcc_consume_token(-1);
                 throw new ParseException();
         }
     }
 }