Пример #1
0
 static private string Continue(ref int command_ptr, ref int NextIndex, ref int line_ptr, ref bool DontSkipNextCommand)
 {
     while (OpenedBlocks.Count > 0)
     {
         var NextBlock = OpenedBlocks.Peek();
         if (NextBlock.type == BlockType.While || NextBlock.type == BlockType.For || NextBlock.type == BlockType.DoUntil)
         {
             command_ptr         = NextBlock.command_ptr;
             line_ptr            = NextBlock.line_ptr;
             NextIndex           = NextBlock.NextIndex;
             DontSkipNextCommand = false;
             return(null);
         }
         OpenedBlocks.Pop();
     }
     return("BAD_CONTINUE");
 }
Пример #2
0
        static private string DoUntilBlockProcess(ref int command_ptr, ref int NextIndex, ref int line_ptr, string Command)
        {
            var DoUntilBlock = OpenedBlocks.Peek();

            if (DoUntilBlock.type != BlockType.DoUntil)
            {
                return("BAD_BLOCK");
            }
            string expression;
            var    res = GetNextExpression(Command, ref NextIndex, ref line_ptr, out expression, true);

            if (!res)
            {
                return("BAD_EXPRESSION");
            }
            bool until_result;
            var  Result = GetBoolFuncExpressionResult(expression, out until_result);

            if (Result == null)
            {
                if (until_result)
                {
                    OpenedBlocks.Pop();
                    return(null);
                }
                else
                {
                    command_ptr = DoUntilBlock.command_ptr;
                    NextIndex   = DoUntilBlock.NextIndex;
                    line_ptr    = DoUntilBlock.line_ptr;
                    return(null);
                }
            }
            else
            {
                return(Result);
            }
        }