Example #1
0
        public Block( Command[] commands )
        {
            List<Command> cmds = new List<Command>();

            int i = 0;
            while ( i < commands.Length )
            {
                Command cmd = commands[ i++ ];
                cmds.Add( cmd );

                if ( cmd.CommandType.BlockOpen )
                {
                    List<Command> block = new List<Command>();
                    int depth = 0;
                    while ( i < commands.Length )
                    {
                        Command bcmd = commands[ i++ ];
                        if ( bcmd.CommandType.BlockClose )
                        {
                            --depth;

                            if ( depth == -1 )
                            {
                                if ( bcmd.CommandType.BlockOpen )
                                    --i;

                                break;
                            }
                        }

                        if ( bcmd.CommandType.BlockOpen )
                            ++depth;

                        block.Add( bcmd );
                    }

                    cmd.InnerBlock = new Block( block.ToArray() );
                }
            }

            Commands = cmds.ToArray();
        }
 internal ParameterParseException( Command command )
     : base("Error when parsing parameters for \"" + command.Identifier
         + "\" at line " + command.LineNumber + ".")
 {
 }
 internal ParameterParseException( Command command, String message )
     : base("Error when parsing parameters for \"" + command.Identifier
         + "\" at line " + command.LineNumber + ":\n" + message)
 {
 }
 public virtual void ExitInnerBlock( Command command, Thread thread, Scope scope )
 {
 }
 public virtual void Execute( Command command, Thread thread, Scope scope )
 {
 }