コード例 #1
0
        void execute_command(Command command)
        {
            MainLoop loop = main_loop_stack.Peek();

            loop.ExecuteCommand(command);

            wait_for_completion();
        }
コード例 #2
0
        public void DoRunMainLoop()
        {
            string s;
            bool   is_complete = true;

            parser.Reset();
            while ((s = ReadInput(is_complete)) != null)
            {
                MainLoop loop = main_loop_stack.Peek();

                interpreter.ClearInterrupt();

                if (s == "")
                {
                    if (!is_complete || !loop.Repeat())
                    {
                        continue;
                    }

                    wait_for_completion();

                    parser.Reset();
                    is_complete = true;
                    continue;
                }

                parser.Append(s);
                if (!parser.IsComplete())
                {
                    is_complete = false;
                    continue;
                }

                Command command = parser.GetCommand();
                if (command == null)
                {
                    interpreter.Error("No such command `{0}'.", s);
                }
                else
                {
                    loop.ExecuteCommand(command);
                    wait_for_completion();
                }

                parser.Reset();
                is_complete = true;
            }
        }