public override void VisitLoopElement(LoopElement element)
 {
     Console.WriteLine("loop element: {0}",element.getText());
 }
    public override void VisitLoopElement(LoopElement element)
    {
        resultMessage += "parsing loop element"+"\n";
        loop = element.getText();
        int inc=0;
        int mode = 0;
        CharEnumerator ce = loop.GetEnumerator();
        string remloop="0";
        ce.MoveNext();
        while( inc < loop.Length)
        {
            //Console.WriteLine("Writing loop value {0}", ce.Current);

            if (ce.Current.CompareTo('(') == 0 && mode != -1)
                mode = 1;
            if (ce.Current.CompareTo(' ') == 0)
            {
                remloop = loop.Substring(inc);
                break;

            }

            if (mode == 1 && ce.Current.CompareTo('(')!=0)
            {
               loopvar = string.Concat(loopvar, ce.Current.ToString());
            }

            ce.MoveNext();
            inc++;
        }
        inc = 0;
        mode = 0;
        Console.WriteLine(" variable met in loop element:{0}",loopvar);
        resultMessage += String.Format(" variable met in loop element:{0}", loopvar)+"\n";
        Console.WriteLine(" substring left to parse:{0}", remloop);
        resultMessage += string.Format(" substring left to parse:{0}", remloop)+"\n";
        ce = remloop.GetEnumerator();
        ce.MoveNext();
        ce.MoveNext();
        string startvar="";
        string endvar="";
        while (inc < remloop.Length)
        {
            if (ce.Current.CompareTo('.') > 0 && mode == 0)
            {
                startvar += ce.Current.ToString();
            }
            else if(ce.Current.CompareTo('.')==0)
            {
                mode = 1;
            }
            else if (ce.Current.CompareTo(')') == 0)
            {
                break;
            }
            if (mode == 1 && ce.Current.CompareTo('.')!=0)
            {
                endvar += ce.Current.ToString();
            }
            ce.MoveNext();
            inc++;
        }
        Console.WriteLine("starting var of the loop is: {0}\n ending var of the loop is:{1}", startvar,endvar);
        resultMessage += string.Format("starting var of the loop is: {0}\n ending var of the loop is:{1}", startvar, endvar)+"\n";
        startloopvar = int.Parse(startvar);
        endloopvar = int.Parse(endvar);
    }