Esempio n. 1
0
 public LocationPathExpr()
 {
     state = START;
     s = null;
     pathType = RELATIVE_PATH;
     currentStep = null;
     //fib = new FastIntBuffer(8);// page size 256 = 2^ 8
     ih = new intHash();
 }
Esempio n. 2
0
        public Step prevS; // points to the prev step

        #endregion Fields

        #region Constructors

        public Step()
        {
            nextS = prevS = (Step)null;
            p = pt = null;
            nt = null;
            ft = true;
            //position = 1;
            hasPredicate = false;
            nt_eval = false;
            out_of_range = false;
        }
Esempio n. 3
0
        private int process_self(VTDNav vn)
        {
            bool b1 = false;
            Predicate t = null;
            int result;
            switch (state)
            {
                case START:
                case FORWARD:
                    t = currentStep.p;
                    while (t != null)
                    {
                        if (t.requireContext)
                        {
                            int i = computeContextSize(t, vn);
                            if (i == 0)
                            {
                                b1 = true;
                                break;
                            }
                            else
                                t.ContextSize=(i);
                        }
                        t = t.nextP;
                    }
                    if (b1)
                    {
                        if (state == FORWARD)
                        {
                            state = BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                        else
                            state = END;
                        break;
                    }
                    if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                            && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
                    {
                        if (currentStep.nextS != null)
                        {
                            state = FORWARD;
                            currentStep = currentStep.nextS;
                        }
                        else
                        {
                            state = TERMINAL;
                            if (vn.atTerminal)
                                result = vn.LN;
                            else
                                result = vn.getCurrentIndex2();
                            if (isUnique(result))
                                return result;
                        }
                    }
                    else
                    {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        if (state == START)
                            state = END;
                        else
                            state = BACKWARD;
                    }
                    break;

                case END:
                    currentStep = null;
                    // reset();
                    return -1;

                case BACKWARD:
                case TERMINAL:
                    if (currentStep.prevS != null)
                    {
                        state = BACKWARD;
                        currentStep = currentStep.prevS;
                    }
                    else
                    {
                        state = END;
                    }
                    break;

                default:
                    throw new XPathEvalException("unknown state");
            }
            return -2;
        }
Esempio n. 4
0
        public override int evalNodeSet(VTDNav vn)
        {
            int result;
            if (currentStep == null)
            {
                if (pathType == ABSOLUTE_PATH)
                {
                    vn.toElement(VTDNav.ROOT);
                    vn.toElement(VTDNav.PARENT);
                }
                currentStep = s;
                if (currentStep == null)
                {
                    if (state == START)
                    {
                        state = END;
                        return 0;
                    }
                    else
                    {
                        return -1;
                    }
                }
            }

            while (true)
            {
                switch (currentStep.axis_type)
                {

                    case AxisType.CHILD0:
                        if ((result = process_child(vn)) != -2)
                        {
                            return result;
                        }
                        break;
                    case AxisType.CHILD:
                        if ((result = process_child2(vn)) != -2)
                        {
                            return result;
                        }
                        break;
                    case AxisType.DESCENDANT_OR_SELF0:
                    case AxisType.DESCENDANT0:
                    case AxisType.PRECEDING0:
                    case AxisType.FOLLOWING0:
                        if ((result = process_DDFP(vn)) != -2)
                            return result;
                        break;
                    case AxisType.DESCENDANT_OR_SELF:
                    case AxisType.DESCENDANT:
                    case AxisType.PRECEDING:
                    case AxisType.FOLLOWING:
                        if ((result = process_DDFP2(vn)) != -2)
                            return result;
                        break;
                    case AxisType.PARENT:
                        if ((result = process_parent(vn)) != -2)
                            return result;
                        break;
                    case AxisType.ANCESTOR:
                        if ((result = process_ancestor2(vn)) != -2)
                            return result;
                        break;
                    case AxisType.ANCESTOR_OR_SELF:
                        if ((result = process_ancestor_or_self2(vn)) != -2)
                            return result;
                        break;
                    case AxisType.SELF:
                        if ((result = process_self2(vn)) != -2)
                            return result;
                        break;
                    case AxisType.FOLLOWING_SIBLING:
                        if ((result = process_following_sibling2(vn)) != -2)
                            return result;
                        break;
                    case AxisType.FOLLOWING_SIBLING0:
                        if ((result = process_following_sibling(vn)) != -2)
                            return result;
                        break;
                    case AxisType.PRECEDING_SIBLING:
                        if ((result = process_preceding_sibling2(vn)) != -2)
                            return result;
                        break;
                    case AxisType.PRECEDING_SIBLING0:
                        if ((result = process_preceding_sibling(vn)) != -2)
                            return result;
                        break;
                    case AxisType.ATTRIBUTE:
                        if ((result = process_attribute(vn)) != -2)
                            return result;
                        break;
                    default:
                        if ((result = process_namespace(vn)) != -2)
                            return result;
                        break;
                }
            }
        }
Esempio n. 5
0
        private int process_preceding_sibling(VTDNav vn)
        {
            bool b = false, b1 = false;
            Predicate t = null;
            int result;
            switch (state)
            {
                case START:
                case FORWARD:
                    t = currentStep.p;
                    while (t != null)
                    {
                        if (t.requireContext)
                        {
                            int i = computeContextSize(t, vn);
                            if (i == 0)
                            {
                                b1 = true;
                                break;
                            }
                            else
                                t.ContextSize=(i);
                        }
                        t = t.nextP;
                    }
                    if (b1)
                    {
                        if (state == FORWARD)
                        {
                            state = BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                        else
                            state = END;
                        break;
                    }
                    if (state == START)
                        state = END;
                    else
                        state = BACKWARD;
                    vn.push2();
                    while (vn.toElement(VTDNav.PS))
                    {
                        if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
                        {
                            if (currentStep.nextS != null)
                            {
                                state = FORWARD;
                                currentStep = currentStep.nextS;
                                break;
                            }
                            else
                            {
                                state = TERMINAL;
                                result = vn.getCurrentIndex2();
                                if (isUnique(result))
                                    return result;
                            }
                        }
                    }
                    if(state == END)  {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        vn.pop2();
                    }else if (state == BACKWARD)
                    {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        vn.pop2();
                        currentStep = currentStep.prevS;
                    }
                    break;

                case END:
                    currentStep = null;
                    // reset();
                    return -1;

                case BACKWARD:
                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_preceding_sibling(vn);
                        break;
                    }
                    while (vn.toElement(VTDNav.PS))
                    {
                        if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
                        {
                            if (currentStep.nextS != null)
                            {
                                state = FORWARD;
                                currentStep = currentStep.nextS;
                                b = true;
                                break;
                            }
                            else
                            {
                                state = TERMINAL;
                                result = vn.getCurrentIndex2();
                                if (isUnique(result))
                                    return result;
                            }
                        }
                    }
                    if (b == false)
                    {
                        currentStep.out_of_range = false;
                        transition_preceding_sibling(vn);
                    }
                    break;

                case TERMINAL:
                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_preceding_sibling(vn);
                        break;
                    }
                    while (vn.toElement(VTDNav.PS))
                    {
                        if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
                        {
                            // state =  TERMINAL;
                            result = vn.getCurrentIndex2();
                            if (isUnique(result))
                                return result;
                        }
                    }
                    currentStep.out_of_range = false;
                    transition_preceding_sibling(vn);
                    break;

                default:
                    throw new XPathEvalException("unknown state");
            }
            return -2;
        }
Esempio n. 6
0
        private int process_DDFP(VTDNav vn)
        {
            AutoPilot ap;
            bool b = false, b1 = false;
            Predicate t = null;
            int result;

            switch (state)
            {
                case START:
                case FORWARD:

                    t = currentStep.p;
                    while (t != null)
                    {
                        if (t.requireContext)
                        {
                            int i = computeContextSize(t, vn);
                            if (i == 0)
                            {
                                b1 = true;
                                break;
                            }
                            else
                                t.ContextSize=(i);
                        }
                        t = t.nextP;
                    }
                    if (b1)
                    {
                        if (state == START)
                            state = END;
                        else
                        {
                            currentStep = currentStep.prevS;
                            state = BACKWARD;
                        }
                        break;
                    }

                    String helper = null;
                    if (currentStep.nt.testType == NodeTest.NAMETEST)
                    {
                        helper = currentStep.nt.nodeName;
                    }
                    else if (currentStep.nt.testType == NodeTest.NODE)
                    {
                        helper = "*";
                    }
                    else
                        throw new XPathEvalException("can't run descendant "
                                + "following, or following-sibling axis over comment(), pi(), and text()");
                    if (currentStep.o == null)
                        currentStep.o = ap = new AutoPilot(vn);
                    else
                    {
                        ap = (AutoPilot)currentStep.o;
                        ap.bind(vn);
                    }
                    if (currentStep.ft)
                    {
                        if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF0)
                            if (currentStep.nt.testType == NodeTest.NODE || helper.Equals("*"))
                                ap.Special=(true);
                            else
                                ap.Special=(false);
                        //currentStep.o = ap = new AutoPilot(vn);
                        if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF0)
                            ap.selectElement(helper);
                        else if (currentStep.axis_type == AxisType.DESCENDANT0)
                            ap.selectElement_D(helper);
                        else if (currentStep.axis_type == AxisType.PRECEDING0)
                            ap.selectElement_P(helper);
                        else
                            ap.selectElement_F(helper);
                        currentStep.ft = false;
                    }
                    if (state == START)
                        state = END;

                    vn.push2(); // not the most efficient. good for now
                    //System.out.println("  --++ push in //");
                    b = false;
                    while (ap.iterate())
                    {
                        if (!currentStep.hasPredicate || currentStep.evalPredicates(vn))
                        {
                            b = true;
                            break;
                        }
                    }
                    if (b == false)
                    {
                        vn.pop2();
                        //System.out.println("  --++ pop in //");
                        currentStep.ft = true;
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        if (state == FORWARD)
                        {
                            state = BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                    }
                    else
                    {
                        if (currentStep.nextS != null)
                        {
                            state = FORWARD;
                            currentStep = currentStep.nextS;
                        }
                        else
                        {
                            //vn.pop();
                            state = TERMINAL;
                            result = vn.getCurrentIndex2();
                            if (isUnique(result))
                                return result;
                        }
                    }
                    break;

                case END:
                    currentStep = null;
                    // reset();
                    return -1;

                case BACKWARD:
                    //currentStep = currentStep.prevS;
                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_DDFP(vn);
                        break;
                    }
                    ap = (AutoPilot)currentStep.o;
                    //vn.push();
                    //b = false;
                    while (ap.iterate())
                    {
                        if (!currentStep.hasPredicate || currentStep.evalPredicates(vn))
                        {
                            b = true;
                            break;
                        }
                    }
                    if (b)
                    {
                        //if (currentStep.nextS != null)
                        //{
                            //vn.push();
                            //System.out.println("  --++ push in //");
                            state = FORWARD;
                            currentStep = currentStep.nextS;
                        //}
                        //else
                        //{
                        //    state = TERMINAL;
                        //    result = vn.getCurrentIndex();
                        //    if (isUnique(result))
                        //        return result;
                        //}
                    }
                    else
                    {
                        currentStep.out_of_range = false;
                        transition_DDFP(vn);
                    }
                    break;

                case TERMINAL:
                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_DDFP(vn);
                        break;
                    }
                    ap = (AutoPilot)currentStep.o;
                    b = false;
                    while (ap.iterate())
                    {
                        if (!currentStep.hasPredicate || currentStep.evalPredicates(vn))
                        {
                            b = true;
                            break;
                        }
                    }
                    if (b)
                    {
                        //if (currentStep.evalPredicates(vn)) {
                        result = vn.getCurrentIndex2();
                        if (isUnique(result))
                            return result;
                        //}
                    }
                    else
                    {
                        currentStep.out_of_range = false;
                        transition_DDFP(vn);
                    }
                    break;

                default:
                    throw new XPathEvalException("unknown state");
            }
            return -2;
        }
Esempio n. 7
0
        private int process_namespace(VTDNav vn)
        {
            AutoPilot ap = null;
            bool b1 = false;
            Predicate t = null;
            int temp;
            switch (state)
            {
                case START:
                case FORWARD:

                    t = currentStep.p;
                    while (t != null)
                    {
                        if (t.requireContext)
                        {
                            int i = computeContextSize(t, vn);
                            if (i == 0)
                            {
                                b1 = true;
                                break;
                            }
                            else
                                t.ContextSize=(i);
                        }
                        t = t.nextP;
                    }
                    if (b1)
                    {
                        if (state == FORWARD)
                        {
                            state = BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                        else
                            state = END;
                        break;
                    }

                    if (vn.atTerminal)
                    {
                        if (state == START)
                            state = END;
                        else
                        {
                            state = BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                    }
                    else
                    {

                        if (currentStep.ft)
                        {
                            if (currentStep.o == null)
                                currentStep.o = ap = new AutoPilot(vn);
                            else
                            {
                                ap = (AutoPilot)currentStep.o;
                                ap.bind(vn);
                                //ap.set_ft(true);
                            }
                            if (currentStep.nt.testType == NodeTest.NODE)
                                ap.selectNameSpace("*");
                            else
                                ap.selectNameSpace(currentStep.nt.nodeName);
                            currentStep.ft = false;
                        }
                        if (state == START)
                            state = END;
                        vn.push2();
                        //vn.setAtTerminal(true);
                        while ((temp = ap.iterateNameSpace()) != -1)
                        {
                            if ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))
                            {
                                break;
                            }
                        }
                        if (temp == -1)
                        {
                            vn.pop2();
                            currentStep.ft = true;
                            if (currentStep.hasPredicate)
                                currentStep.resetP(vn);
                            vn.atTerminal=(false);
                            if (state == FORWARD)
                            {
                                state = BACKWARD;
                                currentStep = currentStep.prevS;
                            }
                        }
                        else
                        {
                            vn.atTerminal=(true);
                            if (currentStep.nextS != null)
                            {
                                vn.LN = temp;
                                state = FORWARD;
                                currentStep = currentStep.nextS;
                            }
                            else
                            {
                                //vn.pop();
                                state = TERMINAL;
                                if (isUnique(temp))
                                {
                                    vn.LN = temp;
                                    return temp;
                                }
                            }

                        }
                    }
                    break;

                case END:
                    currentStep = null;
                    // reset();
                    return -1;

                case BACKWARD:
                    ap = (AutoPilot)currentStep.o;
                    //vn.push();
                    while ((temp = ap.iterateNameSpace()) != -1)
                    {
                        if ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))
                        {
                            break;
                        }
                    }
                    if (temp == -1)
                    {
                        vn.pop2();
                        currentStep.ft = true;
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        vn.atTerminal=(false);
                        if (currentStep.prevS != null)
                        {
                            state = BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                        else
                            state = END;
                    }
                    else
                    {
                        if (currentStep.nextS != null)
                        {
                            state = FORWARD;
                            currentStep = currentStep.nextS;
                        }
                        else
                        {
                            state = TERMINAL;
                            if (isUnique(temp))
                            {
                                vn.LN = temp;
                                return temp;
                            }
                        }
                    }
                    break;

                case TERMINAL:
                    ap = (AutoPilot)currentStep.o;
                    while ((temp = ap.iterateNameSpace()) != -1)
                    {
                        if (!currentStep.hasPredicate || currentStep.evalPredicates(vn))
                        {
                            break;
                        }
                    }
                    if (temp != -1)
                        if (isUnique(temp))
                        {
                            vn.LN = temp;
                            return temp;
                        }
                    vn.atTerminal=(false);
                    if (currentStep.hasPredicate)
                        currentStep.resetP(vn);
                    if (currentStep.prevS == null)
                    {
                        currentStep.ft = true;
                        vn.pop2();
                        state = END;
                    }
                    else
                    {
                        state = BACKWARD;
                        vn.pop2();
                        currentStep.ft = true;
                        currentStep = currentStep.prevS;
                    }

                    break;

                default:
                    throw new XPathEvalException("unknown state");
            }
            return -2;
        }
Esempio n. 8
0
        public override System.String evalString(VTDNav vn)
        {
            String s = "";
            int a = -1;
            vn.push2();
            int size = vn.contextStack2.size;
            try
            {
                a = evalNodeSet(vn);
                if (a != -1)
                {
                    int t = vn.getTokenType(a);
                    switch (t)
                    {
                        case VTDNav.TOKEN_STARTING_TAG:
                        case VTDNav.TOKEN_DOCUMENT:
                            s = vn.getXPathStringVal2(a,(short)0);
                            break;
                        case VTDNav.TOKEN_ATTR_NAME:
                            s = vn.toString(a + 1);
                            break;
                        case VTDNav.TOKEN_PI_NAME:
                            //if (a + 1 < vn.vtdSize
                            //		|| vn.getTokenType(a + 1) == VTDNav.TOKEN_PI_VAL)
                            s = vn.toString(a + 1);
                            break;
                        default:
                            s = vn.toString(a);
                            break;
                    }
                }
            }
            catch (Exception e)
            {

            }
            vn.contextStack2.size = size;
            reset(vn);
            vn.pop2();
            return s;
        }
Esempio n. 9
0
		private int process_attribute(VTDNav vn)
		{
			AutoPilot ap = null;
			bool  b1 = false;
			//int contextSize;
			Predicate t = null;
			//int result;
			int temp;
			switch (state)
			{
				
				case START: 
				case FORWARD: 
					
					t = currentStep.p;
					while (t != null)
					{
						if (t.requireContextSize())
						{
							int i = computeContextSize(t, vn);
							if (i == 0)
							{
								b1 = true;
								break;
							}
							else
								t.ContextSize = i;
						}
						t = t.nextP;
					}
					if (b1)
					{
						if (state == FORWARD)
						{
							state = BACKWARD;
							currentStep = currentStep.PrevStep;
						}
						else
							state = END;
						break;
					}
					
					if (vn.AtTerminal == true)
					{
						if (state == START)
							state = END;
						else
						{
							state = BACKWARD;
							currentStep = currentStep.PrevStep;
						}
					}
					else
					{
						if (currentStep.get_ft() == true)
						{
							if (currentStep.o == null)
								currentStep.o = ap = new AutoPilot(vn);
							else
							{
								ap = (AutoPilot) currentStep.o;
								ap.bind(vn);
								//ap.set_ft(true);	
							}
							if (currentStep.nt.localName != null)
								ap.selectAttrNS(currentStep.nt.URL, currentStep.nt.localName);
							else
								ap.selectAttr(currentStep.nt.nodeName);
							currentStep.set_ft(false);
						}
						if (state == START)
							state = END;
						vn.AtTerminal = true;
						while ((temp = ap.iterateAttr()) != - 1)
						{
							if (currentStep.evalPredicates(vn))
							{
								break;
							}
						}
						if (temp == - 1)
						{
							currentStep.set_ft(true);
							currentStep.resetP(vn);
							vn.AtTerminal = false;
							if (state == FORWARD)
							{
								state = BACKWARD;
								currentStep = currentStep.PrevStep;
							}
						}
						else
						{
							
							if (currentStep.NextStep != null)
							{
								vn.LN = temp;
								state = FORWARD;
								currentStep = currentStep.NextStep;
							}
							else
							{
								//vn.pop();
								state = TERMINAL;
								if (isUnique(temp))
								{
									vn.LN = temp;
									return temp;
								}
							}
						}
					}
					break;
				
				
				case END: 
					currentStep = null;
					// reset();
					return - 1;
				
				
				case BACKWARD: 
					ap = (AutoPilot) currentStep.o;
					//vn.push();
					while ((temp = ap.iterateAttr()) != - 1)
					{
						if (currentStep.evalPredicates(vn))
						{
							break;
						}
					}
					if (temp == - 1)
					{
						currentStep.set_ft(true);
						currentStep.resetP(vn);
						vn.AtTerminal = false;
						if (currentStep.PrevStep != null)
						{
							state = BACKWARD;
							currentStep = currentStep.PrevStep;
						}
						else
							state = END;
					}
					else
					{
						if (currentStep.NextStep != null)
						{
							state = FORWARD;
							currentStep = currentStep.NextStep;
						}
						else
						{
							state = TERMINAL;
							if (isUnique(temp))
							{
								vn.LN = temp;
								return temp;
							}
						}
					}
					break;
				
				
				case TERMINAL: 
					ap = (AutoPilot) currentStep.o;
					while ((temp = ap.iterateAttr()) != - 1)
					{
						if (currentStep.evalPredicates(vn))
						{
							break;
						}
					}
					if (temp != - 1)
						if (isUnique(temp))
						{
							vn.LN = temp;
							return temp;
						}
					vn.AtTerminal = false;
					currentStep.resetP(vn);
					if (currentStep.PrevStep == null)
					{
						currentStep.set_ft(true);
						state = END;
					}
					else
					{
						state = BACKWARD;
						currentStep.set_ft(true);
						currentStep = currentStep.PrevStep;
					}
					
					break;
				
				
				default: 
					throw new XPathEvalException("unknown state");
				
			}
			return - 2;
		}
Esempio n. 10
0
        protected internal int process_parent2(VTDNav vn)
        {
            bool b1 = false;
            Predicate t= null;
            int result;
            switch ( state) {
            case  START:
            case  FORWARD:
                t = currentStep.p;
                while(t!=null){
                    if (t.requireContext){
                        int i = computeContextSize(t,vn);
                        if (i==0){
                            b1 = true;
                            break;
                        }else
                            t.ContextSize=(i);
                    }
                    t = t.nextP;
                }
                if (b1){
                    if (state == FORWARD){
                        state = BACKWARD;
                        currentStep = currentStep.prevS;
                    }else
                        state = END;
                    break;
                }

                if (vn.getCurrentDepth() == -1) {
                    if ( state ==  START)
                         state =  END;
                    else {
                        //vn.pop();
                         state =  BACKWARD;
                        currentStep = currentStep.prevS;
                    }
                } else {
                    vn.push2();
                    vn.toNode(VTDNav.P); // must return true
                    if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                            && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){
                        if (currentStep.nextS != null) {
                            state =  FORWARD;
                           currentStep = currentStep.nextS;
                        } else {
                            state =  TERMINAL;
                           result = vn.getCurrentIndex2();
                            if ( isUnique(result))
                                return result;
                        }
                    }else{
                        vn.pop2();
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        if ( state ==  START)
                             state =  END;
                        else {
                             state =  BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                    }
                }

                break;

            case  END:
                currentStep = null;
                // reset();
                return -1;

            case  BACKWARD:
            case  TERMINAL:
                if (currentStep.prevS == null) {
                    vn.pop2();
                     state =  END;
                    break;
                }else {
                    vn.pop2();
                     state =  BACKWARD;
                    currentStep = currentStep.prevS;
                    break;
                }

            default:
                throw new  XPathEvalException("unknown state");

            }
            return -2;
        }
Esempio n. 11
0
 protected internal void transition_child(VTDNav vn)
 {
     vn.toElement(VTDNav.P);
     if (currentStep.prevS != null){
         currentStep = currentStep.prevS;
         state = BACKWARD;
     }else{
         state = END;
     }
 }
Esempio n. 12
0
        /** Method with the actual generated action code. */
        public TUVienna.CS_CUP.Runtime.Symbol CUP_parser_do_action(
    int                        CUP_parser_act_num,
    TUVienna.CS_CUP.Runtime.lr_parser CUP_parser_parser,
    System.Collections.Stack            xstack1,
    int                        CUP_parser_top)
        {
            /* Symbol object for return from actions */
              mStack CUP_parser_stack =new mStack(xstack1);
              TUVienna.CS_CUP.Runtime.Symbol CUP_parser_result;

              /* select the action based on the action number */
              switch (CUP_parser_act_num)
            {
              /*. . . . . . . . . . . . . . . . . . . .*/
              case 65: // FunctionName ::= FNAME
            {
              FuncName RESULT = null;
            int fnleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int fnright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            FuncName fn = (FuncName)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = fn;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(2/*FunctionName*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 64: // VariableReference ::= DOLLAR NAME
            {
              Expr RESULT = null;
            int nleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int nright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            NameType n = (NameType)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;

               		  if (my_parser.symbolHash[n.qname]==null)
               		    throw new XPathParseException("variableExpression not declared ==> $"+n.qname);
               		    RESULT = new VariableExpr(n.qname, (Expr)my_parser.symbolHash[n.qname]);

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(13/*VariableReference*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 63: // Predicate ::= LB Expr RB
            {
              Predicate RESULT = null;
            int eleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left;
            int eright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right;
            Expr e = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value;
            RESULT = new Predicate();
            if (e.isFinal() && e.Numerical)
            {
                RESULT.d = e.evalNumber((VTDNav)null);
                Yylex scanner = (Yylex)my_parser.getScanner();
                if (RESULT.d < 1)
                    throw new XPathParseException("invalid index number for predicate",
                            scanner.getOffset());
                RESULT.type = Predicate.simple;
            }
            RESULT.expr = e;
            RESULT.requireContext = e.requireContextSize();

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(28/*Predicate*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 62: // AbbreviatedRelativeLocationPath ::= Step DSLASH RelativeLocationPath
            {
              Step RESULT = null;
            int sleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int sright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Step s = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int rlpleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int rlpright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Step rlp = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new Step();
              RESULT.AxisType = AxisType.DESCENDANT_OR_SELF;
              my_parser.tempNt = new NodeTest();

              my_parser.tempNt.TestType = NodeTest.NODE;
              RESULT.NodeTest = my_parser.tempNt;
              s.NextStep=RESULT;
              RESULT.PrevStep=s;
              RESULT.NextStep=rlp;
              rlp.PrevStep=RESULT;
              RESULT = s;

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(27/*AbbreviatedRelativeLocationPath*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 61: // AbbreviatedAbsoluteLocationPath ::= DSLASH RelativeLocationPath
            {
              Step RESULT = null;
            int rlpleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int rlpright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Step rlp = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;

              RESULT = new Step();
              RESULT.AxisType=AxisType.DESCENDANT_OR_SELF;
              my_parser.tempNt = new NodeTest();
              my_parser.tempNt.TestType=NodeTest.NODE;
              RESULT.NodeTest=my_parser.tempNt;
              RESULT.NextStep=rlp;
              rlp.PrevStep=RESULT;

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(26/*AbbreviatedAbsoluteLocationPath*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 60: // AbbreviatedStep ::= DDOT
            {
              Step RESULT = null;
              RESULT = new Step();
            my_parser.tempNt = new NodeTest();
              		    my_parser.tempNt.TestType=NodeTest.NODE;
            RESULT.AxisType=AxisType.PARENT;
            RESULT.NodeTest=my_parser.tempNt;

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(23/*AbbreviatedStep*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 59: // AbbreviatedStep ::= DOT
            {
              Step RESULT = null;
              RESULT = new Step();
            my_parser.tempNt = new NodeTest();
              		    my_parser.tempNt.TestType=NodeTest.NODE;
            RESULT.AxisType=AxisType.SELF;
            RESULT.NodeTest=my_parser.tempNt;

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(23/*AbbreviatedStep*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 58: // AbbreviatedAxisSpecifier ::= AT
            {
              AxisType RESULT = null;
             RESULT = new AxisType(); RESULT.i = AxisType.ATTRIBUTE;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(20/*AbbreviatedAxisSpecifier*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 57: // AbbreviatedAxisSpecifier ::=
            {
              AxisType RESULT = null;
             RESULT = new AxisType(); RESULT.i = AxisType.CHILD;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(20/*AbbreviatedAxisSpecifier*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 56: // AxisSpecifier ::= AbbreviatedAxisSpecifier
            {
              AxisType RESULT = null;
            int aasleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int aasright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            AxisType aas = (AxisType)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
              RESULT = aas;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(19/*AxisSpecifier*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 55: // AxisSpecifier ::= AXISNAME
            {
              AxisType RESULT = null;
            int anleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int anright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            AxisType an = (AxisType)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
              RESULT = an;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(19/*AxisSpecifier*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 54: // PredicateList ::= Predicate PredicateList
            {
              Predicate RESULT = null;
            int pleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left;
            int pright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right;
            Predicate p = (Predicate)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value;
            int plleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int plright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Predicate pl = (Predicate)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
              p.nextP = pl;
            RESULT = p;

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(29/*PredicateList*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 53: // PredicateList ::=
            {
              Predicate RESULT = null;
             RESULT = null;

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(29/*PredicateList*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 52: // nodetest ::= NTEST
            {
              NodeTest RESULT = null;
            int n2left = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int n2right = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Ntest n2 = (Ntest)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new NodeTest();
              		   if (n2.i!=3)
               	RESULT.TestType=n2.i;
               else {
               	if (n2.arg ==null)
               	   RESULT.TestType=n2.i; //PI0
               	else {
               		RESULT.TestType=4; //PI1
               		RESULT.NodeName=n2.arg;
               	}
               }

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(21/*nodetest*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 51: // nodetest ::= NAME
            {
              NodeTest RESULT = null;
            int nleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int nright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            NameType n = (NameType)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new NodeTest();
             	   RESULT.TestType=NodeTest.NAMETEST;
               RESULT.NodeName=n.qname;
               if (n.localname!=null){
               	 RESULT.setNodeNameNS(n.prefix,n.localname);
               	 if (my_parser.nsHash==null || my_parser.nsHash[n.prefix] ==null)

               	    throw new XPathParseException("No URL found for prefix:"+n.prefix);
               	 RESULT.URL = (String) my_parser.nsHash[n.prefix];
               }

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(21/*nodetest*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 50: // Step ::= AbbreviatedStep
            {
              Step RESULT = null;
            int absleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int absright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Step abs = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = abs; /*System.out.println(" step 4");*/

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(22/*Step*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 49: // Step ::= AxisSpecifier nodetest PredicateList
            {
              Step RESULT = null;
            int as1left = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int as1right = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            AxisType as1 = (AxisType)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int ntleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left;
            int ntright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right;
            NodeTest nt = (NodeTest)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value;
            int plleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int plright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Predicate pl = (Predicate)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new Step();
              	   RESULT.AxisType=as1.i;
              	   if ( (as1.i== AxisType.ATTRIBUTE
              	         || as1.i == AxisType.NAMESPACE) &&
              	        (nt.testType>1)){
              	          Yylex scanner = (Yylex)my_parser.getScanner();
              	          throw new XPathParseException(as1.getAxisString()+" axis can't operate on"+
              	                 " comment(), pi(), or text()",
              	         	scanner.getOffset());
              	         	}

              	   RESULT.NodeTest=nt;
               RESULT.Predicate=pl;
               //System.out.println(" Step 3 ");

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(22/*Step*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 48: // RelativeLocationPath ::= AbbreviatedRelativeLocationPath
            {
              Step RESULT = null;
            int arlpleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int arlpright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Step arlp = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = arlp;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(24/*RelativeLocationPath*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 47: // RelativeLocationPath ::= Step SLASH RelativeLocationPath
            {
              Step RESULT = null;
            int sleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int sright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Step s = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int rlpleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int rlpright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Step rlp = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             //if (s == rlp) throw new XPathParseException("$1 = $3!!!!");
               s.NextStep= rlp;
               rlp.PrevStep = s;
               RESULT= s;

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(24/*RelativeLocationPath*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 46: // RelativeLocationPath ::= Step
            {
              Step RESULT = null;
            int sleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int sright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Step s = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = s;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(24/*RelativeLocationPath*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 45: // AbsoluteLocationPath ::= AbbreviatedAbsoluteLocationPath
            {
              Step RESULT = null;
            int aalpleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int aalpright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Step aalp = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
              RESULT = aalp;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(25/*AbsoluteLocationPath*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 44: // AbsoluteLocationPath ::= SLASH RelativeLocationPath
            {
              Step RESULT = null;
            int rlpleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int rlpright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Step rlp = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
              RESULT = rlp;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(25/*AbsoluteLocationPath*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 43: // AbsoluteLocationPath ::= SLASH
            {
              Step RESULT = null;
              RESULT = null;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(25/*AbsoluteLocationPath*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 42: // LocationPath ::= AbsoluteLocationPath
            {
              LocationPathExpr RESULT = null;
            int alpleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int alpright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Step alp = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new LocationPathExpr();
               RESULT.PathType=LocationPathExpr.ABSOLUTE_PATH;
               //System.out.println(" absolute ");
               RESULT.Step=alp;
               RESULT.optimize();
               //startStep = currentStep=null;

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(18/*LocationPath*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 41: // LocationPath ::= RelativeLocationPath
            {
              LocationPathExpr RESULT = null;
            int rlpleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int rlpright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Step rlp = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new LocationPathExpr();
               RESULT.Step=rlp;
               RESULT.optimize();
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(18/*LocationPath*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 40: // Argument ::= Expr
            {
              Expr RESULT = null;
            int eleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int eright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr e = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = e;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(17/*Argument*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 39: // ArgumentList ::= Argument COMMA ArgumentList
            {
              Alist RESULT = null;
            int aleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int aright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr a = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int alleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int alright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Alist al = (Alist)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new Alist();
               RESULT.e = a;
               RESULT.next = al;

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(15/*ArgumentList*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 38: // ArgumentList ::= Argument
            {
              Alist RESULT = null;
            int aleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int aright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr a = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new Alist();
               RESULT.e = a;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(15/*ArgumentList*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 37: // ArgumentList ::=
            {
              Alist RESULT = null;
             RESULT = null;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(15/*ArgumentList*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 36: // FunctionCall ::= FunctionName LP ArgumentList RP
            {
              FuncExpr RESULT = null;
            int fnleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-3)).left;
            int fnright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-3)).right;
            FuncName fn = (FuncName)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-3)).value;
            int alleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left;
            int alright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right;
            Alist al = (Alist)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value;
             //RESULT = new FuncExpr(fn.i, al);
             FuncExpr tfe = new FuncExpr(fn.i, al);
             if (!tfe.checkArgumentCount())
             throw new XPathParseException(" argument input for function " + tfe.fname() + " incorrect");
             RESULT = tfe;

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(1/*FunctionCall*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-3)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 35: // PrimaryExpr ::= FunctionCall
            {
              Expr RESULT = null;
            int fcleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int fcright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            FuncExpr fc = (FuncExpr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = fc;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(16/*PrimaryExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 34: // PrimaryExpr ::= NUMBER
            {
              Expr RESULT = null;
            int neleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int neright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Double ne = (Double)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new NumExpr(ne);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(16/*PrimaryExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 33: // PrimaryExpr ::= LITERAL
            {
              Expr RESULT = null;
            int leleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int leright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            String le = (String)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new LiteralExpr(le);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(16/*PrimaryExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 32: // PrimaryExpr ::= LP Expr RP
            {
              Expr RESULT = null;
            int eleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left;
            int eright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right;
            Expr e = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value;
             RESULT = e;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(16/*PrimaryExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 31: // PrimaryExpr ::= VariableReference
            {
              Expr RESULT = null;
            int veleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int veright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ve = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = ve;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(16/*PrimaryExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 30: // FilterExpr ::= FilterExpr Predicate
            {
              Expr RESULT = null;
            int feleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left;
            int feright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right;
            Expr fe = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value;
            int pleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int pright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Predicate p = (Predicate)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new FilterExpr(fe, p);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(12/*FilterExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 29: // FilterExpr ::= PrimaryExpr
            {
              Expr RESULT = null;
            int peleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int peright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr pe = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = pe;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(12/*FilterExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 28: // PathExpr ::= FilterExpr DSLASH RelativeLocationPath
            {
              Expr RESULT = null;
            int feleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int feright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr fe = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int rlpleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int rlpright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Step rlp = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
               my_parser.tempStep = new Step();

             my_parser.tempStep.AxisType=AxisType.DESCENDANT_OR_SELF;
             my_parser.tempNt = new NodeTest();
             my_parser.tempNt.TestType=NodeTest.NODE;

             my_parser.tempStep.NodeTest=my_parser.tempNt;

             my_parser.tempStep.NextStep=rlp;
             rlp.PrevStep=my_parser.tempStep;

             /*parser.tempStep2 = new Step();
             parser.tempNt = new NodeTest();
             parser.tempStep2.AxisType=AxisType.SELF;
             parser.tempNt.TestType=NodeTest.NODE;

             parser.tempStep2.NodeTest=parser.tempNt;

              		     parser.tempStep2.NextStep=parser.tempStep;
             parser.tempStep.PrevStep=parser.tempStep2;*/

             my_parser.tempLPExpr = new LocationPathExpr();
             my_parser.tempLPExpr.Step=my_parser.tempStep;
             RESULT = new PathExpr(fe, my_parser.tempLPExpr);

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(11/*PathExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 27: // PathExpr ::= FilterExpr SLASH RelativeLocationPath
            {
              Expr RESULT = null;
            int feleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int feright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr fe = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int rlpleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int rlpright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Step rlp = (Step)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
               my_parser.tempLPExpr = new LocationPathExpr();
             my_parser.tempLPExpr.Step=rlp;
             RESULT = new PathExpr(fe, my_parser.tempLPExpr);

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(11/*PathExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 26: // PathExpr ::= FilterExpr
            {
              Expr RESULT = null;
            int feleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int feright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr fe = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
              RESULT = fe;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(11/*PathExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 25: // PathExpr ::= LocationPath
            {
              Expr RESULT = null;
            int lpleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int lpright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            LocationPathExpr lp = (LocationPathExpr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
              RESULT = lp;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(11/*PathExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 24: // UnionExpr ::= PathExpr UNION UnionExpr
            {
              UnionExpr RESULT = null;
            int peleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int peright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr pe = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int uneleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int uneright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            UnionExpr une = (UnionExpr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;

               		   RESULT = new UnionExpr(pe);
               		   RESULT.next = une;

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(14/*UnionExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 23: // UnionExpr ::= PathExpr
            {
              UnionExpr RESULT = null;
            int peleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int peright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr pe = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT =  new UnionExpr(pe);

              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(14/*UnionExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 22: // UnaryExpr ::= SUB UnaryExpr
            {
              Expr RESULT = null;
            int ueleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int ueright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ue = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new UnaryExpr( BinaryExpr.SUB, ue);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(10/*UnaryExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 21: // UnaryExpr ::= UnionExpr
            {
              Expr RESULT = null;
            int ueleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int ueright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            UnionExpr ue = (UnionExpr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
            if (ue.next == null)
            RESULT = ue.e;
            else
            RESULT = ue;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(10/*UnaryExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 20: // MultiplicativeExpr ::= MultiplicativeExpr MOD UnaryExpr
            {
              Expr RESULT = null;
            int meleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int meright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr me = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int ueleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int ueright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ue = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(me, BinaryExpr.MOD, ue);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(9/*MultiplicativeExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 19: // MultiplicativeExpr ::= MultiplicativeExpr DIV UnaryExpr
            {
              Expr RESULT = null;
            int meleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int meright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr me = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int ueleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int ueright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ue = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(me, BinaryExpr.DIV, ue);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(9/*MultiplicativeExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 18: // MultiplicativeExpr ::= MultiplicativeExpr MULT UnaryExpr
            {
              Expr RESULT = null;
            int meleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int meright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr me = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int ueleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int ueright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ue = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(me, BinaryExpr.MULT, ue);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(9/*MultiplicativeExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 17: // MultiplicativeExpr ::= UnaryExpr
            {
              Expr RESULT = null;
            int ueleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int ueright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ue = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = ue;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(9/*MultiplicativeExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 16: // AdditiveExpr ::= AdditiveExpr SUB MultiplicativeExpr
            {
              Expr RESULT = null;
            int aeleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int aeright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr ae = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int meleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int meright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr me = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(ae, BinaryExpr.SUB, me);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(8/*AdditiveExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 15: // AdditiveExpr ::= AdditiveExpr ADD MultiplicativeExpr
            {
              Expr RESULT = null;
            int aeleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int aeright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr ae = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int meleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int meright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr me = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(ae, BinaryExpr.ADD, me);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(8/*AdditiveExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 14: // AdditiveExpr ::= MultiplicativeExpr
            {
              Expr RESULT = null;
            int meleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int meright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr me = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = me;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(8/*AdditiveExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 13: // RelationalExpr ::= RelationalExpr GE AdditiveExpr
            {
              Expr RESULT = null;
            int releft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int reright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr re = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int aeleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int aeright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ae = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(re, BinaryExpr.GE, ae);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(7/*RelationalExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 12: // RelationalExpr ::= RelationalExpr LE AdditiveExpr
            {
              Expr RESULT = null;
            int releft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int reright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr re = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int aeleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int aeright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ae = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(re, BinaryExpr.LE, ae);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(7/*RelationalExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 11: // RelationalExpr ::= RelationalExpr GT AdditiveExpr
            {
              Expr RESULT = null;
            int releft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int reright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr re = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int aeleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int aeright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ae = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(re, BinaryExpr.GT, ae);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(7/*RelationalExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 10: // RelationalExpr ::= RelationalExpr LT AdditiveExpr
            {
              Expr RESULT = null;
            int releft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int reright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr re = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int aeleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int aeright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ae = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(re, BinaryExpr.LT, ae);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(7/*RelationalExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 9: // RelationalExpr ::= AdditiveExpr
            {
              Expr RESULT = null;
            int aeleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int aeright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ae = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = ae;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(7/*RelationalExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 8: // EqualityExpr ::= EqualityExpr NE RelationalExpr
            {
              Expr RESULT = null;
            int eeleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int eeright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr ee = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int releft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int reright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr re = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(ee, BinaryExpr.NE, re);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(5/*EqualityExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 7: // EqualityExpr ::= EqualityExpr EQ RelationalExpr
            {
              Expr RESULT = null;
            int eeleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int eeright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr ee = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int releft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int reright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr re = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(ee, BinaryExpr.EQ, re);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(5/*EqualityExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 6: // EqualityExpr ::= RelationalExpr
            {
              Expr RESULT = null;
            int releft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int reright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr re = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = re;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(5/*EqualityExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 5: // AndExpr ::= AndExpr AND EqualityExpr
            {
              Expr RESULT = null;
            int aleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int aright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr a = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int eeleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int eeright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ee = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(a, BinaryExpr.AND, ee);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(6/*AndExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 4: // AndExpr ::= EqualityExpr
            {
              Expr RESULT = null;
            int eeleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int eeright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr ee = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = ee;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(6/*AndExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 3: // OrExpr ::= OrExpr OR AndExpr
            {
              Expr RESULT = null;
            int oleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left;
            int oright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right;
            Expr o = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value;
            int aleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int aright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr a = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = new BinaryExpr(o,BinaryExpr.OR,a);
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(4/*OrExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 2: // OrExpr ::= AndExpr
            {
              Expr RESULT = null;
            int aleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int aright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr a = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = a;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(4/*OrExpr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 1: // $START ::= Expr EOF
            {
              object RESULT = null;
            int start_valleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left;
            int start_valright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right;
            Expr start_val = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value;
            RESULT = start_val;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(0/*$START*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              /* ACCEPT */
              CUP_parser_parser.done_parsing();
              return CUP_parser_result;

              /*. . . . . . . . . . . . . . . . . . . .*/
              case 0: // Expr ::= OrExpr
            {
              Expr RESULT = null;
            int oleft = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left;
            int oright = ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right;
            Expr o = (Expr)((TUVienna.CS_CUP.Runtime.Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value;
             RESULT = o;
              CUP_parser_result = new TUVienna.CS_CUP.Runtime.Symbol(3/*Expr*/, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((TUVienna.CS_CUP.Runtime.Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT);
            }
              return CUP_parser_result;

              /* . . . . . .*/
              default:
            throw new System.Exception(
               "Invalid action number found in internal parse table");

            }
        }
Esempio n. 13
0
		internal bool ft; // first time
		public Step()
		{
			nextS = prevS = (Step) null;
			p = pt = null;
			nt = null;
			ft = true;
			position = 1;
		}
Esempio n. 14
0
		private int process_parent(VTDNav vn)
		{
			bool b1 = false;
			//int contextSize;
			Predicate t = null;
			int result;
			switch (state)
			{
				
				case START: 
				case FORWARD: 
					t = currentStep.p;
					while (t != null)
					{
						if (t.requireContextSize())
						{
							int i = computeContextSize(t, vn);
							if (i == 0)
							{
								b1 = true;
								break;
							}
							else
								t.ContextSize = i;
						}
						t = t.nextP;
					}
					if (b1)
					{
						if (state == FORWARD)
						{
							state = BACKWARD;
							currentStep = currentStep.PrevStep;
						}
						else
							state = END;
						break;
					}
					
					if (vn.getCurrentDepth() == - 1)
					{
						if (state == START)
							state = END;
						else
						{
							//vn.pop();
							state = BACKWARD;
							currentStep = currentStep.PrevStep;
						}
					}
					else
					{
						vn.push2();
						vn.toElement(VTDNav.P); // must return true
						if (currentStep.eval(vn))
						{
							if (currentStep.NextStep != null)
							{
								state = FORWARD;
								currentStep = currentStep.NextStep;
							}
							else
							{
								state = TERMINAL;
								result = vn.getCurrentIndex();
								if (isUnique(result))
									return result;
							}
						}
						else
						{
							vn.pop2();
							currentStep.resetP(vn);
							if (state == START)
								state = END;
							else
							{
								state = BACKWARD;
								currentStep = currentStep.PrevStep;
							}
						}
					}
					
					break;
				
				
				case END: 
					currentStep = null;
					// reset();
					return - 1;
				
				
				case BACKWARD: 
				case TERMINAL: 
					if (currentStep.PrevStep == null)
					{
						vn.pop2();
						state = END;
						break;
					}
					else
					{
						vn.pop2();
						state = BACKWARD;
						currentStep = currentStep.PrevStep;
						break;
					}
					//goto default;
				
				
				default: 
					throw new XPathEvalException("unknown state");
				
			}
			return - 2;
		}
Esempio n. 15
0
		private int process_DDFP(VTDNav vn)
		{
			AutoPilot ap;
			bool b = false, b1 = false;
			//int contextSize;
			Predicate t = null;
			int result;
			
			
			switch (state)
			{
				
				case START: 
				case FORWARD: 
					if (vn.atTerminal)
					{
						if (state == START)
							state = END;
						else
						{
							// no need to set_ft to true
							// no need to resetP
							state = BACKWARD;
							currentStep = currentStep.PrevStep;
						}
						break;
					}
					
					t = currentStep.p;
					while (t != null)
					{
						if (t.requireContextSize())
						{
							int i = computeContextSize(t, vn);
							if (i == 0)
							{
								b1 = true;
								break;
							}
							else
								t.ContextSize = i;
						}
						t = t.nextP;
					}
					if (b1)
					{
						if (state == START)
							state = END;
						else
						{
							currentStep = currentStep.PrevStep;
							state = BACKWARD;
						}
						break;
					}
					
					System.String helper = null;
					if (currentStep.nt.testType == NodeTest.NODE)
					{
						helper = "*";
					}
					else
					{
						helper = currentStep.nt.nodeName;
					}
					if (currentStep.o == null)
						currentStep.o = ap = new AutoPilot(vn);
					else
					{
						ap = (AutoPilot) currentStep.o;
						ap.bind(vn);
					}
					if (currentStep.get_ft() == true)
					{
						
						if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF)
							if (currentStep.nt.testType == NodeTest.NODE)
								ap.Special = true;
							else
								ap.Special = false;
						//currentStep.o = ap = new AutoPilot(vn);
						if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF)
							ap.selectElement(helper);
						else if (currentStep.axis_type == AxisType.DESCENDANT)
							ap.selectElement_D(helper);
						else if (currentStep.axis_type == AxisType.PRECEDING)
							ap.selectElement_P(helper);
						else
							ap.selectElement_F(helper);
						currentStep.set_ft(false);
					}
					if (state == START)
						state = END;
					
					vn.push2(); // not the most efficient. good for now
					//System.out.println("  --++ push in //");
					b = false;
					while (ap.iterate())
					{
						if (currentStep.evalPredicates(vn))
						{
							b = true;
							break;
						}
					}
					if (b == false)
					{
						vn.pop2();
						//System.out.println("  --++ pop in //");
						currentStep.set_ft(true);
						currentStep.resetP(vn);
						if (state == FORWARD)
						{
							state = BACKWARD;
							currentStep = currentStep.PrevStep;
						}
					}
					else
					{
						if (currentStep.NextStep != null)
						{
							state = FORWARD;
							currentStep = currentStep.NextStep;
						}
						else
						{
							//vn.pop();
							state = TERMINAL;
							result = vn.getCurrentIndex();
							if (isUnique(result))
								return result;
						}
					}
					break;
				
				
				case END: 
					currentStep = null;
					// reset();
					return - 1;
				
				
				case BACKWARD: 
					//currentStep = currentStep.getPrevStep();
					ap = (AutoPilot) currentStep.o;
					//vn.push();
					b = false;
					while (ap.iterate())
					{
						if (currentStep.evalPredicates(vn))
						{
							b = true;
							break;
						}
					}
					if (b == false)
					{
						vn.pop2();
						currentStep.set_ft(true);
						currentStep.resetP(vn);
						//System.out.println("  --++ pop in //");
						if (currentStep.PrevStep != null)
						{
							state = BACKWARD;
							currentStep = currentStep.PrevStep;
						}
						else
							state = END;
					}
					else
					{
						if (currentStep.NextStep != null)
						{
							//vn.push();
							//System.out.println("  --++ push in //");
							state = FORWARD;
							currentStep = currentStep.NextStep;
						}
						else
						{
							state = TERMINAL;
							result = vn.getCurrentIndex();
							if (isUnique(result))
								return result;
						}
					}
					break;
				
				
				case TERMINAL: 
					ap = (AutoPilot) currentStep.o;
					b = false;
					while (ap.iterate())
					{
						if (currentStep.evalPredicates(vn))
						{
							b = true;
							break;
						}
					}
					if (b == true)
					{
						if (currentStep.evalPredicates(vn))
						{
							result = vn.getCurrentIndex();
							if (isUnique(result))
								return result;
						}
					}
					else if (currentStep.PrevStep == null)
					{
						currentStep.resetP(vn);
						vn.pop2();
						state = END;
					}
					else
					{
						vn.pop2();
						currentStep.set_ft(true);
						currentStep.resetP(vn);
						//System.out.println(" --++ pop in //");
						state = BACKWARD;
						//currentStep.ft = true;
						currentStep = currentStep.PrevStep;
					}
					break;
				
				
				default: 
					throw new XPathEvalException("unknown state");
				
			}
			return - 2;
		}
Esempio n. 16
0
		private int process_child(VTDNav vn)
		{
			int result;
			bool b = false, b1 = false;
			//int contextSize;
			Predicate t = null;
			
			switch (state)
			{
				
				case START: 
					if (currentStep.nt.testType != NodeTest.TEXT)
					{
						// first search for any predicate that 
						// requires contextSize
						// if so, compute its context size
						// if size > 0
						// set context
						// if size ==0 
						// immediately set the state to backward or end
						t = currentStep.p;
						while (t != null)
						{
							if (t.requireContextSize())
							{
								int i = computeContextSize(t, vn);
								if (i == 0)
								{
									b1 = true;
									break;
								}
								else
									t.ContextSize = i;
							}
							t = t.nextP;
						}
						if (b1)
						{
							state = END;
							break;
						}
						
						b = vn.toElement(VTDNav.FIRST_CHILD);
						state = END;
						if (b == true)
						{
							do 
							{
								if (currentStep.eval(vn))
								{
									if (currentStep.NextStep != null)
									{
										//currentStep.position++;
										state = FORWARD;
										currentStep = currentStep.NextStep;
									}
									else
									{
										state = TERMINAL;
										result = vn.getCurrentIndex();
										if (isUnique(result))
										{
											return result;
										}
									}
									break;
								}
							}
							while (vn.toElement(VTDNav.NS));
							if (state == END)
								vn.toElement(VTDNav.PARENT);
						}
					}
					else
					{
                        if (vn.AtTerminal == true)
                        {
                            state = END;
                        }
                        else
                        {
                            // compute context size;
                            t = currentStep.p;
                            while (t != null)
                            {
                                if (t.requireContextSize())
                                {
                                    int i = computeContextSize(t, vn);
                                    if (i == 0)
                                    {
                                        b1 = true;
                                        break;
                                    }
                                    else
                                        t.ContextSize=i;
                                }
                                t = t.nextP;
                            }
                            // b1 false indicate context size is zero. no need to go any further...
                            if (b1)
                            {
                                state = END;
                                break;
                            }
                            // get textIter
                            TextIter ti = null;
                            if (currentStep.o != null)
                            {
                                ti = (TextIter)currentStep.o;
                            }
                            else
                            {
                                ti = new TextIter();
                                currentStep.o = ti;
                            }
                            ti.touch(vn);
                            state = END;
                            while ((result = ti.getNext()) != -1)
                            {
                                if (currentStep.evalPredicates(vn))
                                {
                                    break;
                                }
                            }
                            // old code
                            //result = vn.getText();
                            if (result != -1)
                            {
                                vn.AtTerminal=true;
                                //currentStep.resetP(vn);
                                vn.LN = result;
                                if (currentStep.NextStep != null)
                                {
                                    vn.LN = result;
                                    state = FORWARD;
                                    currentStep = currentStep.NextStep;
                                }
                                else
                                {
                                    //vn.pop();
                                    state = TERMINAL;
                                    if (isUnique(result))
                                    {
                                        vn.LN = result;
                                        return result;
                                    }
                                }
                            }
                            else
                            {
                                //currentStep.set_ft(true);
                                currentStep.resetP(vn);
                                vn.AtTerminal=false;
                            }
                        }		    
					}
					break;
				
				case END: 
					currentStep = null;
					// reset();
					return - 1;
				
				
				case FORWARD: 
					if (currentStep.nt.testType != NodeTest.TEXT)
					{
						t = currentStep.p;
						while (t != null)
						{
							if (t.requireContextSize())
							{
								int i = computeContextSize(t, vn);
								if (i == 0)
								{
									b1 = true;
									break;
								}
								else
									t.ContextSize = i;
							}
							t = t.nextP;
						}
						if (b1)
						{
							currentStep = currentStep.PrevStep;
							state = BACKWARD;
							break;
						}
						
						state = BACKWARD;
						if (vn.toElement(VTDNav.FC))
						{
							do 
							{
								if (currentStep.eval(vn))
								{
									if (currentStep.NextStep != null)
									{
										state = FORWARD;
										currentStep = currentStep.NextStep;
									}
									else
									{
										state = TERMINAL;
										result = vn.getCurrentIndex();
										if (isUnique(result))
											return result;
									}
									//UPGRADE_NOTE: Labeled break statement was changed to a goto statement. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1012'"
									goto forward_brk;
								}
							}
							while (vn.toElement(VTDNav.NS));
							vn.toElement(VTDNav.P);
							currentStep.resetP(vn);
							currentStep = currentStep.PrevStep;
						}
						else
						{
							//vn.toElement(VTDNav.P);
							currentStep = currentStep.PrevStep;
						}
						//UPGRADE_NOTE: Label 'forward_brk' was added. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1011'"

forward_brk: ;
						
					}
					else
					{
                        // predicate at an attribute is not evaled
                        if (vn.AtTerminal == true)
                        {
                            state = BACKWARD;
                            currentStep = currentStep.PrevStep;
                        }
                        else
                        {
                            // compute context size;
                            t = currentStep.p;
                            while (t != null)
                            {
                                if (t.requireContextSize())
                                {
                                    int i = computeContextSize(t, vn);
                                    if (i == 0)
                                    {
                                        b1 = true;
                                        break;
                                    }
                                    else
                                        t.ContextSize=i;
                                }
                                t = t.nextP;
                            }
                            // b1 false indicate context size is zero. no need to go any further...
                            if (b1)
                            {
                                state = BACKWARD;
                                break;
                            }
                            // get textIter
                            TextIter ti = null;
                            if (currentStep.o != null)
                            {
                                ti = (TextIter)currentStep.o;
                            }
                            else
                            {
                                ti = new TextIter();
                                currentStep.o = ti;
                            }
                            ti.touch(vn);
                            //result = ti.getNext();

                            while ((result = ti.getNext()) != -1)
                            {
                                if (currentStep.evalPredicates(vn))
                                {
                                    break;
                                }
                            }

                            if (result == -1)
                            {
                                //currentStep.set_ft(true);
                                //currentStep.resetP(vn);
                                vn.AtTerminal=false;
                                if (state == FORWARD)
                                {
                                    state = BACKWARD;
                                    currentStep = currentStep.PrevStep;
                                }
                            }
                            else
                            {
                                vn.AtTerminal=true;
                                if (currentStep.NextStep != null)
                                {
                                    vn.LN = result;
                                    state = FORWARD;
                                    currentStep = currentStep.NextStep;
                                }
                                else
                                {
                                    //vn.pop();
                                    state = TERMINAL;
                                    if (isUnique(result))
                                    {
                                        vn.LN = result;
                                        return result;
                                    }
                                }
                            }
                        }				
					}
					
					break;
				
				
				case BACKWARD: 
					if (currentStep.nt.testType != NodeTest.TEXT)
					{
						//currentStep = currentStep.getPrevStep();
						b = false;
						while (vn.toElement(VTDNav.NS))
						{
							if (currentStep.eval(vn))
							{
								b = true;
								break;
							}
						}
						if (b == true)
						{
							state = FORWARD;
							currentStep = currentStep.NextStep;
						}
						else if (currentStep.PrevStep == null)
						{
							currentStep.resetP(vn);
							vn.toElement(VTDNav.P);
							state = END;
						}
						else
						{
							currentStep.resetP(vn);
							state = BACKWARD;
							vn.toElement(VTDNav.P);
							currentStep = currentStep.PrevStep;
						}
					}
					else
					{
						vn.AtTerminal = false;
						if (currentStep.PrevStep == null)
							state = END;
						else
						{
							state = BACKWARD;
							//vn.setAtTerminal(false);
							currentStep = currentStep.PrevStep;
						}
					}
					break;
				
				
				case TERMINAL: 
					if (currentStep.nt.testType != NodeTest.TEXT)
					{
						while (vn.toElement(VTDNav.NS))
						{
							if (currentStep.eval(vn))
							{
								// state =  TERMINAL;
								result = vn.getCurrentIndex();
								if (isUnique(result))
									return result;
							}
						}
						currentStep.resetP(vn);
						if (currentStep.PrevStep == null)
						{
							state = END;
							vn.toElement(VTDNav.P);
						}
						else
						{
							vn.toElement(VTDNav.P);
							
							state = BACKWARD;
							currentStep = currentStep.PrevStep;
						}
					}
					else
					{
                        TextIter ti = (TextIter)currentStep.o;
                        while ((result = ti.getNext()) != -1)
                        {
                            if (currentStep.evalPredicates(vn))
                            {
                                if (isUnique(result))
                                    return result;
                            }
                        }
                        currentStep.resetP(vn);
                        vn.AtTerminal=false;
                        if (currentStep.PrevStep == null)
                            state = END;
                        else
                        {
                            state = BACKWARD;
                            currentStep = currentStep.PrevStep;
                        }
					}
					break;
				
				
				default: 
					throw new XPathEvalException("unknown state");
				
			}
			return - 2;
		}
Esempio n. 17
0
 private void transition_ancestor_or_self(VTDNav vn)
 {
     //currentStep.out_of_range = false;
     vn.pop2();
     if (currentStep.prevS != null)
     {
         if (currentStep.hasPredicate)
             currentStep.resetP(vn);
         state = BACKWARD;
         currentStep = currentStep.prevS;
     }
     else
     {
         state = END;
     }
 }
Esempio n. 18
0
 public override void reset(VTDNav vn)
 {
     state = START;
     Step temp = s;
     ih.reset();
     currentStep = null;
     while (temp != null)
     {
         temp.reset(vn);
         temp = temp.nextS;
     }
 }
Esempio n. 19
0
 private void transition_preceding_sibling(VTDNav vn)
 {
     vn.pop2();
       	if (currentStep.hasPredicate)
       		currentStep.resetP(vn);
       	if(currentStep.prevS!=null){
         currentStep = currentStep.prevS;
         state = BACKWARD;
     }else{
         state = END;
     }
 }
Esempio n. 20
0
        protected internal int process_ancestor_or_self2(VTDNav vn)
        {
            bool b = false, b1 = false;
            Predicate t= null;
            int result;
            switch ( state) {
            case  START:
                t = currentStep.p;
                while (t != null) {
                    if (t.requireContext) {
                        int i = computeContextSize( t, vn);
                        if (i == 0) {
                            b1 = true;
                            break;
                        } else
                            t.ContextSize = i ;
                    }
                    t = t.nextP;
                }
                if (b1) {
                    state = END;
                    break;
                }
                state =  END;
                vn.push2();

                if (currentStep.ft){
                    currentStep.ft = false;
                    if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                            && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                        if (currentStep.nextS != null) {
                            state =  FORWARD;
                            currentStep = currentStep.nextS;
                            break;
                        } else {
                            //vn.pop();
                            state =  TERMINAL;
                            if (vn.atTerminal)
                                result = vn.LN;
                            else
                                result = vn.getCurrentIndex();
                            if ( isUnique(result))
                                return result;
                        }
                    }
                }

                    while (vn.toNode(VTDNav.P)) {
                        if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                            if (currentStep.nextS != null) {
                                 state =  FORWARD;
                                currentStep = currentStep.nextS;
                                break;
                            } else {
                                //vn.pop();
                                 state =  TERMINAL;
                                result = vn.getCurrentIndex();
                                if ( isUnique(result))
                                    return result;
                            }
                        }
                    }

                if ( state ==  END) {
                    if (currentStep.hasPredicate)
                        currentStep.resetP(vn);
                    vn.pop2();
                }

                break;

            case  FORWARD:
                 t = currentStep.p;
                 while(t!=null){
                    if (t.requireContext){
                         int i = computeContextSize(t,vn);
                         if (i==0){
                             b1 = true;
                             break;
                         }else
                             t.ContextSize=i;
                    }
                    t = t.nextP;
                }
                if (b1){
                    currentStep = currentStep.prevS;
                    state = BACKWARD;
                    break;
                }
                 state =  BACKWARD;
                    vn.push2();
                    if (currentStep.ft ) {
                        currentStep.ft = false;

                        if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                            if (currentStep.nextS != null) {
                                 state =  FORWARD;
                                currentStep = currentStep.nextS;
                                break;
                            } else {
                                //vn.pop();
                                 state =  TERMINAL;
                                 if (vn.atTerminal)
                                     result = vn.LN;
                                 else
                                     result = vn.getCurrentIndex();
                                if ( isUnique(result))
                                    return result;
                            }
                        }
                    }
                        while (vn.toNode(VTDNav.P)) {
                            if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                                    && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                                if (currentStep.nextS != null) {
                                     state =  FORWARD;
                                    currentStep = currentStep.nextS;
                                    break;
                                } else {
                                    //vn.pop();
                                     state =  TERMINAL;
                                    result = vn.getCurrentIndex();
                                    if ( isUnique(result))
                                        return result;
                                }
                            }
                        }

                    if ( state ==  BACKWARD) {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        currentStep.ft = true;
                        vn.pop2();
                        currentStep = currentStep.prevS;
                    }
                    break;

            case  END:
                currentStep = null;
                // reset();
                return -1;

            case  BACKWARD:
                //b = false;
                vn.push2();

                while (vn.toNode(VTDNav.P)) {
                    if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                            && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                        if (currentStep.nextS != null) {
                             state =  FORWARD;
                            currentStep = currentStep.nextS;
                            b = true;
                            break;
                        } else {
                            //vn.pop();
                             state =  TERMINAL;
                            result = vn.getCurrentIndex();
                            if ( isUnique(result))
                                return result;
                        }
                    }
                }
                if (b == false) {
                    vn.pop2();
                    if (currentStep.hasPredicate)
                        currentStep.resetP(vn);
                    if (currentStep.prevS != null) {
                        currentStep.ft = true;
                         state =  BACKWARD;
                        currentStep = currentStep.prevS;
                    } else {
                         state =  END;
                    }
                }
                break;

            case  TERMINAL:
                while (vn.toNode(VTDNav.P)) {
                    if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                            && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                        result = vn.getCurrentIndex();
                        if ( isUnique(result))
                            return result;
                    }
                }
                vn.pop2();
                if (currentStep.hasPredicate)
                    currentStep.resetP(vn);
                if (currentStep.prevS!=null) {
                    currentStep.ft = true;
                     state =  BACKWARD;
                    currentStep = currentStep.prevS;
                }
                else {
                     state =  END;
                }
                break;

            default:
                throw new  XPathEvalException("unknown state");
            }
            return -2;
        }
Esempio n. 21
0
 protected internal void transition_DDFP(VTDNav vn)
 {
     vn.pop2();
     currentStep.ft = true;
     if (currentStep.hasPredicate)
         currentStep.resetP(vn);
     //System.out.println("  --++ pop in //");
     if (currentStep.prevS != null)
     {
         state = BACKWARD;
         currentStep = currentStep.prevS;
     }
     else
         state = END;
 }
Esempio n. 22
0
		private int process_ancestor_or_self(VTDNav vn)
		{
			bool b = false, b1 = false;
			//int contextSize;
			Predicate t = null;
			int result;
			switch (state)
			{
				
				case START: 
					t = currentStep.p;
					while (t != null)
					{
						if (t.requireContextSize())
						{
							int i = computeContextSize(t, vn);
							if (i == 0)
							{
								b1 = true;
								break;
							}
							else
								t.ContextSize = i;
						}
						t = t.nextP;
					}
					if (b1)
					{
						state = END;
						break;
					}
					state = END;
					vn.push2();
					
					if (currentStep.get_ft() == true)
					{
						currentStep.set_ft(false);
						if (currentStep.eval(vn))
						{
							if (currentStep.NextStep != null)
							{
								state = FORWARD;
								currentStep = currentStep.NextStep;
								break;
							}
							else
							{
								//vn.pop();
								state = TERMINAL;
								if (vn.atTerminal)
									result = vn.LN;
								else
									result = vn.getCurrentIndex();
								if (isUnique(result))
									return result;
							}
						}
					}
					
					while (vn.toElement(VTDNav.P))
					{
						if (currentStep.eval(vn))
						{
							if (currentStep.NextStep != null)
							{
								state = FORWARD;
								currentStep = currentStep.NextStep;
								break;
							}
							else
							{
								//vn.pop();
								state = TERMINAL;
								result = vn.getCurrentIndex();
								if (isUnique(result))
									return result;
							}
						}
					}
					
					if (state == END)
					{
						currentStep.resetP(vn);
						vn.pop2();
					}
					
					break;
				
				
				case FORWARD: 
					t = currentStep.p;
					while (t != null)
					{
						if (t.requireContextSize())
						{
							int i = computeContextSize(t, vn);
							if (i == 0)
							{
								b1 = true;
								break;
							}
							else
								t.ContextSize = i;
						}
						t = t.nextP;
					}
					if (b1)
					{
						currentStep = currentStep.PrevStep;
						state = BACKWARD;
						break;
					}
					state = BACKWARD;
					vn.push2();
					if (currentStep.get_ft() == true)
					{
						currentStep.set_ft(false);
						
						if (currentStep.eval(vn))
						{
							if (currentStep.NextStep != null)
							{
								state = FORWARD;
								currentStep = currentStep.NextStep;
								break;
							}
							else
							{
								//vn.pop();
								state = TERMINAL;
								if (vn.atTerminal)
									result = vn.LN;
								else
									result = vn.getCurrentIndex();
								if (isUnique(result))
									return result;
							}
						}
					}
					while (vn.toElement(VTDNav.P))
					{
						if (currentStep.eval(vn))
						{
							if (currentStep.NextStep != null)
							{
								state = FORWARD;
								currentStep = currentStep.NextStep;
								break;
							}
							else
							{
								//vn.pop();
								state = TERMINAL;
								result = vn.getCurrentIndex();
								if (isUnique(result))
									return result;
							}
						}
					}
					
					if (state == BACKWARD)
					{
						currentStep.resetP(vn);
						currentStep.set_ft(true);
						vn.pop2();
						currentStep = currentStep.PrevStep;
					}
					break;
				
				
				case END: 
					currentStep = null;
					// reset();
					return - 1;
				
				
				
				case BACKWARD: 
					b = false;
					vn.push2();
					
					while (vn.toElement(VTDNav.P))
					{
						if (currentStep.eval(vn))
						{
							if (currentStep.NextStep != null)
							{
								state = FORWARD;
								currentStep = currentStep.NextStep;
								b = true;
								break;
							}
							else
							{
								//vn.pop();
								state = TERMINAL;
								result = vn.getCurrentIndex();
								if (isUnique(result))
									return result;
							}
						}
					}
					if (b == false)
					{
						vn.pop2();
						currentStep.resetP(vn);
						if (currentStep.PrevStep != null)
						{
							currentStep.set_ft(true);
							state = BACKWARD;
							currentStep = currentStep.PrevStep;
						}
						else
						{
							state = END;
						}
					}
					break;
				
				
				case TERMINAL: 
					while (vn.toElement(VTDNav.P))
					{
						if (currentStep.eval(vn))
						{
							result = vn.getCurrentIndex();
							if (isUnique(result))
								return result;
						}
					}
					vn.pop2();
					currentStep.resetP(vn);
					if (currentStep.PrevStep != null)
					{
						currentStep.set_ft(true);
						state = BACKWARD;
						currentStep = currentStep.PrevStep;
					}
					else
					{
						state = END;
					}
					break;
				
				
				
				default: 
					throw new XPathEvalException("unknown state");
				
			}
			return - 2;
		}
Esempio n. 23
0
        protected internal int process_ancestor2( VTDNav vn)
        {
            int result;
            bool b = false, b1 = false;
            //int contextSize;
            Predicate t= null;

            switch(state){
            case START:

                t = currentStep.p;
                while (t != null) {
                    if (t.requireContext) {
                        int i = computeContextSize( t, vn);
                        if (i == 0) {
                            b1 = true;
                            break;
                        } else
                            t.ContextSize=(i);
                    }
                    t = t.nextP;
                }
                if (b1) {
                    state = END;
                    break;
                }

                state = END;
                //if (vn.getCurrentDepth() != -1) {
                    vn.push2();

                    while (vn.toNode(VTDNav.P)) {
                        if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                            if (currentStep.nextS != null) {
                                state = FORWARD;
                                currentStep = currentStep.nextS;
                                break;
                            } else {
                                //vn.pop();
                                state = TERMINAL;
                                result = vn.getCurrentIndex2();
                                if (isUnique(result))
                                    return result;
                            }
                        }
                    }
                    if (state == END) {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        vn.pop2();
                    }
               // }
                break;

            case END:
                currentStep =null;
                // reset();
                return -1;

            case FORWARD:
                 t = currentStep.p;
                 while(t!=null){
                    if (t.requireContext){
                         int i = computeContextSize(t,vn);
                         if (i==0){
                             b1 = true;
                             break;
                         }else
                             t.ContextSize=(i);
                    }
                    t = t.nextP;
                }
                if (b1){
                    currentStep = currentStep.prevS;
                    state = BACKWARD;
                    break;
                }
                state =  BACKWARD;
               	vn.push2();

               	while(vn.toNode(VTDNav.P)){
               		if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
               				&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){
               			if (currentStep.nextS != null){
               				 state =  FORWARD;
               				currentStep = currentStep.nextS;
               				break;
               			}
               			else {
               				//vn.pop();
               				 state =  TERMINAL;
               				result = vn.getCurrentIndex2();
                            if ( isUnique(result))
                                return result;
               			}
               		}
               	}
               	if ( state == BACKWARD){
                    if (currentStep.hasPredicate)
                        currentStep.resetP(vn);
                    vn.pop2();
               		currentStep=currentStep.prevS;
               	}
              	break;

            case BACKWARD:
                b = false;
                    //vn.push2();
                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_ancestor(vn);
                        break;
                    }
                    while (vn.toNode(VTDNav.P)) {
                    if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                            && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                        if (currentStep.nextS!= null) {
                             state =  FORWARD;
                            currentStep = currentStep.nextS;
                            b = true;
                            break;
                        } else {
                            //vn.pop();
                             state =  TERMINAL;
                            result = vn.getCurrentIndex2();
                            if ( isUnique(result))
                                return result;
                        }
                    }
                }
                if (b==false){
                        currentStep.out_of_range = false;
                        transition_ancestor(vn);
                    }
                break;

            case TERMINAL:

                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_ancestor(vn);
                        break;
                    }
                    while (vn.toNode(VTDNav.P)) {
                if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                        && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                    result = vn.getCurrentIndex2();
                    if ( isUnique(result))
                        return result;
                }
            }

               currentStep.out_of_range = false;
                    transition_ancestor(vn);
                    break;

            default:
            throw new  XPathEvalException("unknown state");
            }
            return -2;
        }
Esempio n. 24
0
        private int process_child(VTDNav vn)
        {
            int result;
            bool b = false, b1 = false;
            int k=1;
            Predicate t= null;
               // Console.WriteLine(" index-============= " + vn.getCurrentIndex());
               // Console.WriteLine(" depth ==============" + vn.getCurrentDepth());
            switch(state){
                case START:
                    //if (currentStep.nt.testType < NodeTest.TEXT){
                        // first search for any predicate that
                        // requires contextSize
                        // if so, compute its context size
                        // if size > 0
                        // set context
                        // if size ==0
                        // immediately set the state to backward or end
                        t = currentStep.p;
                        while(t!=null){
                            if (t.requireContext){
                                int i = computeContextSize(t,vn);
                                if (i==0){
                                    b1 = true;
                                    break;
                                }else
                                    t.ContextSize=(i);
                            }
                            t = t.nextP;
                        }
                        if (b1){
                            state = END;
                            break;
                        }

                         b=vn.toElement(VTDNav.FIRST_CHILD);
                         state =  END;
                         if (b ){
                         do {
                            if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                    && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                                if (currentStep.nextS != null){
                                    //currentStep.position++;
                                    state =  FORWARD;
                                    currentStep = currentStep.nextS;
                                }
                                else {
                                    state =  TERMINAL;
                                    result = vn.getCurrentIndex2();
                                    if ( isUnique(result)){
                                        return result;
                                    }
                                }
                            break;
                            }
                        } while (vn.toElement(VTDNav.NS));
                        if (state == END)
                            vn.toElement(VTDNav.PARENT);
                     }

                    break;
                case END:
                    currentStep =null;
                    // reset();
                    return -1;

                case FORWARD:
                    //if (currentStep.nt.testType < NodeTest.TEXT){
                        t = currentStep.p;
                        while(t!=null){
                            if (t.requireContext){
                                int i = computeContextSize(t,vn);
                                if (i==0){
                                    b1 = true;
                                    break;
                                }else
                                    t.ContextSize=(i);
                            }
                            t = t.nextP;
                        }
                        if (b1){
                            currentStep = currentStep.prevS;
                            state = BACKWARD;
                            break;
                        }

               			 	state =  BACKWARD;
               			 	if (vn.toElement(VTDNav.FC)) {
                            do {
                                if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                        && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                                    if (currentStep.nextS != null) {
                                         state =  FORWARD;
                                        currentStep = currentStep.nextS;
                                    } else {
                                         state =  TERMINAL;
                                        result = vn.getCurrentIndex2();
                                        if ( isUnique(result))
                                            return result;
                                    }
                                    goto forward;
                                }

                            } while (vn.toElement(VTDNav.NS));
                            vn.toElement(VTDNav.P);
                            if (currentStep.hasPredicate)
                                currentStep.resetP(vn);
                            currentStep = currentStep.prevS;
                        } else {
                            //vn.toElement(VTDNav.P);
                            currentStep = currentStep.prevS;
                        }
                    forward:

                    break;

                case BACKWARD:
                    //if (currentStep.nt.testType < NodeTest.TEXT) {
                        //currentStep = currentStep.prevS;
                        //b = false;
                        if(currentStep.out_of_range){
                            currentStep.out_of_range = false;
                            transition_child(vn);
                            break;
                        }
                        while (vn.toElement(VTDNav.NS)) {
                            if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                    && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                                b = true;
                                break;
                            }
                        }
                        if (b ) {
                            state =  FORWARD;
                            currentStep = currentStep.nextS;
                        } else {
                        currentStep.out_of_range = false;
                        transition_child(vn);
                        }
                    break;

                case TERMINAL:
                        if(currentStep.out_of_range){
                            currentStep.out_of_range = false;
                            transition_child(vn);
                            break;
                        }
                    //if (currentStep.nt.testType < NodeTest.TEXT) {
                        while (vn.toElement(VTDNav.NS)) {
                            if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                    && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                                // state =  TERMINAL;
                                result = vn.getCurrentIndex2();
                                if ( isUnique(result))
                                    return result;
                            }
                        }
                    currentStep.out_of_range = false;
                    transition_child(vn);
                    break;

                default:
                    throw new XPathEvalException("unknown state");
            }
            return -2;
        }