コード例 #1
0
ファイル: ADOPathUtil.cs プロジェクト: modulexcite/pash-1
        public static IADOPathNode CreateFilterClause(ADOperator op, string attributeName, object value)
        {
            IADOPathNode objectADOPathNode;
            IADOPathNode propertyADOPathNode = new PropertyADOPathNode(attributeName);
            string       str = value as string;

            if (str == null)
            {
                objectADOPathNode = new ObjectADOPathNode(value);
            }
            else
            {
                objectADOPathNode = new TextDataADOPathNode(str);
            }
            return(ADOPathUtil.CreateRelationalExpressionNode(op, propertyADOPathNode, objectADOPathNode, null));
        }
コード例 #2
0
        private int yyparse()
        {
            int num;
            int num2;

            this.init_stacks();
            this.yynerrs   = 0;
            this.yyerrflag = 0;
            this.yychar    = -1;
            int state = 0;

            this.state_push(state);
Label_0025:
            num = yydefred[state];
            if (num == 0)
            {
                if (this.yychar < 0)
                {
                    this.yychar = this.yylex();
                    if (this.yychar < 0)
                    {
                        this.yychar = 0;
                    }
                }
                num = yysindex[state];
                if (((num != 0) && ((num += this.yychar) >= 0)) && ((num <= YYTABLESIZE) && (yycheck[num] == this.yychar)))
                {
                    state = yytable[num];
                    this.state_push(state);
                    this.val_push(this.yylval);
                    this.yychar = -1;
                    if (this.yyerrflag > 0)
                    {
                        this.yyerrflag--;
                    }
                }
                else
                {
                    num = yyrindex[state];
                    if (((num != 0) && ((num += this.yychar) >= 0)) && ((num <= YYTABLESIZE) && (yycheck[num] == this.yychar)))
                    {
                        num = yytable[num];
                        goto Label_01D9;
                    }
                    if (this.yyerrflag == 0)
                    {
                        this.yyerror("syntax error");
                        this.yynerrs++;
                    }
                    if (this.yyerrflag < 3)
                    {
                        this.yyerrflag = 3;
                        while (true)
                        {
                            if (this.stateptr < 0)
                            {
                                goto Label_0849;
                            }
                            num = yysindex[this.state_peek(0)];
                            if (((num != 0) && ((num += YYERRCODE) >= 0)) && ((num <= YYTABLESIZE) && (yycheck[num] == YYERRCODE)))
                            {
                                if (this.stateptr < 0)
                                {
                                    goto Label_0849;
                                }
                                state = yytable[num];
                                this.state_push(state);
                                this.val_push(this.yylval);
                                goto Label_0025;
                            }
                            if (this.stateptr < 0)
                            {
                                goto Label_0849;
                            }
                            this.state_pop();
                            this.val_pop();
                        }
                    }
                    if (this.yychar == 0)
                    {
                        goto Label_0854;
                    }
                    this.yychar = -1;
                }
                goto Label_0025;
            }
Label_01D9:
            num2       = yylen[num];
            this.yyval = this.val_peek(num2 - 1);
            switch (num)
            {
            case 1:
                this._filterExprTree = null;
                break;

            case 2:
                this._filterExprTree = (IADOPathNode)this.val_peek(1);
                break;

            case 3:
                this.yyval = this.val_peek(0);
                break;

            case 4:
                this.yyval = new CompositeADOPathNode(ADOperator.And, new IADOPathNode[] { (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0) });
                break;

            case 5:
                this.yyval = new CompositeADOPathNode(ADOperator.Or, new IADOPathNode[] { (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0) });
                break;

            case 6:
                this.yyval = this.val_peek(1);
                break;

            case 7:
                this.yyval = new UnaryADOPathNode(ADOperator.Not, (IADOPathNode)this.val_peek(0));
                break;

            case 8:
                this.yyval = this.val_peek(1);
                break;

            case 9:
                this.yyval = ADOPathUtil.CreateRelationalExpressionNode(ADOperator.Eq, (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0), this._searchFilterConverter);
                break;

            case 10:
                this.yyval = ADOPathUtil.CreateRelationalExpressionNode(ADOperator.Ne, (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0), this._searchFilterConverter);
                break;

            case 11:
                this.yyval = ADOPathUtil.CreateRelationalExpressionNode(ADOperator.Gt, (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0), this._searchFilterConverter);
                break;

            case 12:
                this.yyval = ADOPathUtil.CreateRelationalExpressionNode(ADOperator.Lt, (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0), this._searchFilterConverter);
                break;

            case 13:
                this.yyval = ADOPathUtil.CreateRelationalExpressionNode(ADOperator.Ge, (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0), this._searchFilterConverter);
                break;

            case 14:
                this.yyval = ADOPathUtil.CreateRelationalExpressionNode(ADOperator.Le, (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0), this._searchFilterConverter);
                break;

            case 15:
                this.yyval = ADOPathUtil.CreateRelationalExpressionNode(ADOperator.Like, (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0), this._searchFilterConverter);
                break;

            case 0x10:
                this.yyval = ADOPathUtil.CreateRelationalExpressionNode(ADOperator.NotLike, (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0), this._searchFilterConverter);
                break;

            case 0x11:
                this.yyval = ADOPathUtil.CreateRelationalExpressionNode(ADOperator.Approx, (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0), this._searchFilterConverter);
                break;

            case 0x12:
                this.yyval = ADOPathUtil.CreateRelationalExpressionNode(ADOperator.Band, (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0), this._searchFilterConverter);
                break;

            case 0x13:
                this.yyval = ADOPathUtil.CreateRelationalExpressionNode(ADOperator.Bor, (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0), this._searchFilterConverter);
                break;

            case 20:
                this.yyval = ADOPathUtil.CreateRelationalExpressionNode(ADOperator.RecursiveMatch, (IADOPathNode)this.val_peek(2), (IADOPathNode)this.val_peek(0), this._searchFilterConverter);
                break;

            case 0x15:
                this.yyval = this.val_peek(1);
                break;

            case 0x16:
                if (this.val_peek(0) != null)
                {
                    throw new ADFilterParsingException(this._query, "Operator Not supported: " + this.lexer.yytext(), this.pos + 1);
                }
                break;

            case 0x17:
                this.yyval = this.val_peek(0);
                break;

            case 0x18:
            {
                string data = this.lexer.yytext().Substring(1, this.lexer.yytext().Length - 2).Replace("''", "'");
                this.yyval = new TextDataADOPathNode(data);
                break;
            }

            case 0x19:
            {
                string str2 = this.lexer.yytext().Substring(1, this.lexer.yytext().Length - 2).Replace("`\"", "\"");
                this.yyval = new TextDataADOPathNode(str2);
                break;
            }

            case 0x1a:
                this.yyval = new NumberADOPathNode(this.lexer.yytext());
                break;

            case 0x1b:
                this.yyval = new NumberADOPathNode(this.lexer.yytext());
                break;

            case 0x1c:
                this.yyval = this.val_peek(0);
                break;

            case 0x1d:
                this.yyval = new PropertyADOPathNode(this.lexer.yytext());
                break;

            case 30:
            {
                string varNameStr = this.lexer.yytext().Substring(1);
                this.yyval = new VariableADOPathNode(varNameStr, new EvaluateVariableDelegate(this._varExpressionConverter.GetVariableExpressionValue));
                break;
            }

            case 0x1f:
            {
                string str4 = this.lexer.yytext();
                str4 = str4.Substring(2, str4.Length - 2);
                int index = str4.IndexOf("}");
                str4       = str4.Remove(index, 1);
                this.yyval = new VariableADOPathNode(str4, new EvaluateVariableDelegate(this._varExpressionConverter.GetVariableExpressionValue));
                break;
            }
            }
            this.state_drop(num2);
            state = this.state_peek(0);
            this.val_drop(num2);
            num2 = yylhs[num];
            if ((state == 0) && (num2 == 0))
            {
                state = YYFINAL;
                this.state_push(YYFINAL);
                this.val_push(this.yyval);
                if (this.yychar < 0)
                {
                    this.yychar = this.yylex();
                    if (this.yychar < 0)
                    {
                        this.yychar = 0;
                    }
                }
                if (this.yychar == 0)
                {
                    return(0);
                }
                goto Label_0025;
            }
            num = yygindex[num2];
            if (((num != 0) && ((num += state) >= 0)) && ((num <= YYTABLESIZE) && (yycheck[num] == state)))
            {
                state = yytable[num];
            }
            else
            {
                state = yydgoto[num2];
            }
            if (this.stateptr >= 0)
            {
                this.state_push(state);
                this.val_push(this.yyval);
                goto Label_0025;
            }
Label_0849:
            this.yyerror("yacc stack overflow");
Label_0854:
            return(1);
        }