Esempio n. 1
0
        public InputArgumentList ParseArgs(List <string> argArr,
                                           out int missingArgIndex,
                                           out int missingArgCount,
                                           int flagsToInclude = 0,
                                           int flagsToExclude = 0)
        {
            InputArgumentList args = new InputArgumentList(argArr);

            // FIXME: Handle '@' args (or at least error on them).

            missingArgIndex = missingArgCount = 0;
            int index = 0;
            int end   = argArr.Count;

            while (index < end)
            {
                // Ingore nullptrs, they are response file's EOL markers
                if (args.GetArgString(index) == null)
                {
                    ++index;
                    continue;
                }

                // Ignore empty arguments (other things may still take them as arguments).
                string str = args.GetArgString(index);

                if (string.IsNullOrEmpty(str))
                {
                    ++index;
                    continue;
                }

                int prev = index;

                Argument a = ParseOneArg(args,
                                         ref index,
                                         flagsToInclude,
                                         flagsToExclude);

                //Debug.Assert(index > Prev && "Parser failed to consume argument.");

                // Check for missing argument error.
                if (a == null)
                {
                    //Debug.Assert(index >= End && "Unexpected parser error.");
                    //Debug.Assert(index - Prev - 1 && "No missing arguments!");
                    missingArgIndex = prev;
                    missingArgCount = index - prev - 1;
                    break;
                }

                args.Append(a);
            }

            return(args);
        }
Esempio n. 2
0
 public override string GetArgString(int index)
 {
     return(_baseArgs.GetArgString(index));
 }