Ejemplo n.º 1
0
 public void Execute(Subroutine.Moment pos)
 {
     VarBase v = m_expr.Calculate();
     if (!v.IsSingle())
         throw new CalcException("«начение услови¤ не может быть массивом");
     if ((v as SingleVar).ToBool()) {
         pos.Next();
     }
     else {
         int pos1 = m_nextpos;
         while (true) {
             pos.GoTo(pos1);
             if (pos.Current.GetKind() == OperatorKind.Else) {
                 pos.Next();
                 break;
             }
             else if (pos.Current.GetKind() == OperatorKind.Elseif) {
                 if ((pos.Current as ElseifOperator).TestCondition()) {
                     pos.Next();
                     break;
                 }
                 pos1 = (pos.Current as ElseifOperator).NextPos;
             }
             else if (pos.Current.GetKind() == OperatorKind.Endif) {
                 pos.Next();
                 break;
             }
         }
     }
 }
Ejemplo n.º 2
0
        //****************************************************************************************************
		public void Execute(Subroutine.Moment pos) {
			int pos1 = m_nextpos;
			while (true) {
				pos.GoTo(pos1);
				if (pos.Current.GetKind() == OperatorKind.Elseif) {
					pos1 = (pos.Current as ElseifOperator).NextPos;
				}
				else if (pos.Current.GetKind() == OperatorKind.Else) {
					pos1 = (pos.Current as ElseOperator).NextPos;
				}
				else if (pos.Current.GetKind() == OperatorKind.Endif) {
					pos.Next();
					break;
				}
			}
		}