Exemplo n.º 1
0
        public ContinueState(ICommandDefinition command, PreParserResultBuilder resultBuilder)
        {
            Debug.Assert(command != null);
            Debug.Assert(resultBuilder != null);

            this.command       = command;
            this.resultBuilder = resultBuilder;
        }
Exemplo n.º 2
0
        public StartState(ArgsDefinition definition, PreParserResultBuilder resultBuilder)
        {
            Debug.Assert(definition != null);
            Debug.Assert(resultBuilder != null);

            this.definition    = definition;
            this.resultBuilder = resultBuilder;
        }
Exemplo n.º 3
0
        protected static IPreParsingState HandleKeyValueOptionArgument(
            ICommandDefinition command,
            PreParserResultBuilder resultBuilder,
            string argument)
        {
            IOptionDefinition kvOption = ResolveKeyValueOptionLabel(
                command,
                argument);

            return(kvOption != null
                ? new WaitingValueState(command, kvOption, argument, resultBuilder)
                : null);
        }
Exemplo n.º 4
0
        protected static IPreParsingState HandleFreeValueArgument(ICommandDefinition selectedCommand,
                                                                  PreParserResultBuilder resultBuilder, string argument)
        {
            if (selectedCommand.AllowFreeValue)
            {
                resultBuilder.AppendFreeValue(argument);
                return(new ContinueFreeValueState(selectedCommand, resultBuilder));
            }

            throw new ArgParsingException(
                      ArgsParsingErrorCode.FreeValueNotSupported,
                      argument);
        }
Exemplo n.º 5
0
        public WaitingValueState(
            ICommandDefinition command,
            IOptionDefinition kvOption,
            string labelArgument,
            PreParserResultBuilder resultBuilder)
        {
            Debug.Assert(command != null);
            Debug.Assert(kvOption != null);
            Debug.Assert(resultBuilder != null);

            this.command       = command;
            this.kvOption      = kvOption;
            this.labelArgument = labelArgument;
            this.resultBuilder = resultBuilder;
        }
Exemplo n.º 6
0
        protected static IPreParsingState HandleFlagOptionArgument(
            ICommandDefinition command,
            PreParserResultBuilder resultBuilder,
            string argument)
        {
            IList <IOptionDefinition> flagOptions = ResolveFlagOptionLabels(
                command,
                argument);

            if (flagOptions.Count > 0)
            {
                foreach (IOptionDefinition flagOption in flagOptions)
                {
                    resultBuilder.AppendOptionToken(new OptionToken(flagOption), argument);
                }
                return(new ContinueState(command, resultBuilder));
            }

            return(null);
        }