示例#1
0
        private IEnumerable<IArgument> InternExecute(IProgramSequence progSeq)
        {
            IEnumerable<IArgument> result = new IArgument[0];

            foreach (ICommand comm in progSeq.Commands)
            {
                // Get command if exists.
                var match = Resolver.Resolve(comm, Environments);

                // Execute command and combine with other results.
                if (match != null){
                    result = result.Concat(match.ExecuteCommand());
                }
                else
                    throw new UnknownCommandException(comm);
            }

            return result;
        }
示例#2
0
 /// <summary>
 /// A constructor for the program sequence.
 /// </summary>
 /// <param name="command">The first command of the program sequence.</param>
 /// <param name="followingCommands">The rest of the program sequence, as a sub-sequence.</param>
 public ProgramSequence(ICommand command, IProgramSequence followingCommands = null)
 {
     Command = command;
     FollowingCommands = followingCommands;
 }