Example #1
0
        private XPathBinaryOpExpr getBinOpExpr(int op, XPathExpression a, XPathExpression b)
        {
            switch (op)
            {
            case Token.OR:  return(new XPathBoolExpr(XPathBoolExpr.OR, a, b));

            case Token.AND:  return(new XPathBoolExpr(XPathBoolExpr.AND, a, b));

            case Token.EQ:  return(new XPathEqExpr(true, a, b));

            case Token.NEQ:  return(new XPathEqExpr(false, a, b));

            case Token.LT:  return(new XPathCmpExpr(XPathCmpExpr.LT, a, b));

            case Token.LTE:  return(new XPathCmpExpr(XPathCmpExpr.LTE, a, b));

            case Token.GT:  return(new XPathCmpExpr(XPathCmpExpr.GT, a, b));

            case Token.GTE:  return(new XPathCmpExpr(XPathCmpExpr.GTE, a, b));

            case Token.PLUS:  return(new XPathArithExpr(XPathArithExpr.ADD, a, b));

            case Token.MINUS:  return(new XPathArithExpr(XPathArithExpr.SUBTRACT, a, b));

            case Token.MULT:  return(new XPathArithExpr(XPathArithExpr.MULTIPLY, a, b));

            case Token.DIV:  return(new XPathArithExpr(XPathArithExpr.DIVIDE, a, b));

            case Token.MOD:  return(new XPathArithExpr(XPathArithExpr.MODULO, a, b));

            case Token.UNION:  return(new XPathUnionExpr(a, b));

            default:  throw new XPathSyntaxException();
            }
        }
Example #2
0
 //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
 public override void  readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
 {
     target        = (TreeReference)ExtUtil.read(in_Renamed, typeof(TreeReference), pf);
     explicitValue = ExtUtil.nullIfEmpty(ExtUtil.readString(in_Renamed));
     if (explicitValue == null)
     {
         value_Renamed = (XPathExpression)ExtUtil.read(in_Renamed, new ExtWrapTagged(), pf);
     }
 }
Example #3
0
        public override XPathExpression build()
        {
            XPathExpression[] preds = new XPathExpression[predicates.Count];
            for (int i = 0; i < preds.Length; i++)
            {
                preds[i] = ((ASTNode)predicates[i]).build();
            }

            return(new XPathFilterExpr(expr.build(), preds));
        }
        public override XPathExpression build()
        {
            XPathExpression[] xargs = new XPathExpression[args.Count];
            for (int i = 0; i < args.Count; i++)
            {
                xargs[i] = ((ASTNode)args[i]).build();
            }

            return(new XPathFuncExpr(name, xargs));
        }
Example #5
0
        public bool hasNow;         //indicates whether this XpathConditional contains the now() function (used for timestamping)

        public XPathConditional(System.String xpath)
        {
            InitBlock();
            hasNow = false;
            if (xpath.IndexOf("now()") > -1)
            {
                hasNow = true;
            }
            this.expr  = XPathParseTool.parseXPath(xpath);
            this.xpath = xpath;
        }
Example #6
0
        public override XPathExpression build()
        {
            System.Collections.ArrayList steps = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            XPathExpression filtExpr           = null;
            int             offset             = Absolute?1:0;

            for (int i = 0; i < clauses.Count + offset; i++)
            {
                if (offset == 0 || i > 0)
                {
                    if (clauses[i - offset] is ASTNodePathStep)
                    {
                        steps.Add(((ASTNodePathStep)clauses[i - offset]).Step);
                    }
                    else
                    {
                        filtExpr = ((ASTNode)clauses[i - offset]).build();
                    }
                }

                if (i < separators.Count)
                {
                    if (Parser.vectInt(separators, i) == Token.DBL_SLASH)
                    {
                        steps.Add(XPathStep.ABBR_DESCENDANTS());
                    }
                }
            }

            XPathStep[] stepArr = new XPathStep[steps.Count];
            for (int i = 0; i < stepArr.Length; i++)
            {
                stepArr[i] = (XPathStep)steps[i];
            }

            if (filtExpr == null)
            {
                return(new XPathPathExpr(Absolute?XPathPathExpr.INIT_CONTEXT_ROOT:XPathPathExpr.INIT_CONTEXT_RELATIVE, stepArr));
            }
            else
            {
                if (filtExpr is XPathFilterExpr)
                {
                    return(new XPathPathExpr((XPathFilterExpr)filtExpr, stepArr));
                }
                else
                {
                    return(new XPathPathExpr(new XPathFilterExpr(filtExpr, new XPathExpression[0]), stepArr));
                }
            }
        }
Example #7
0
 private void  attemptConstraintCompile()
 {
     xPathConstraintMsg = null;
     try
     {
         if (constraintMsg != null)
         {
             xPathConstraintMsg = XPathParseTool.parseXPath("string(" + constraintMsg + ")");
         }
     }
     catch (System.Exception e)
     {
         //Expected in probably most cases.
     }
 }
Example #8
0
 //UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'"
 public virtual void  readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf)
 {
     expr   = (XPathExpression)ExtUtil.read(in_Renamed, new ExtWrapTagged(), pf);
     hasNow = (bool)ExtUtil.readBool(in_Renamed);
 }
Example #9
0
 void getTriggers(XPathExpression x, Set <TreeReference> v, TreeReference contextRef)
Example #10
0
 public XPathConditional(XPathExpression expr)
 {
     InitBlock();
     this.expr = expr;
 }
Example #11
0
 public SetValueAction(TreeReference target, XPathExpression value_Renamed) : base("setvalue")
 {
     this.target        = target;
     this.value_Renamed = value_Renamed;
 }