Exemple #1
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();
                }
            }
        }
Exemple #2
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();
         }
     }
 }