public ContinueState(ICommandDefinition command, PreParserResultBuilder resultBuilder) { Debug.Assert(command != null); Debug.Assert(resultBuilder != null); this.command = command; this.resultBuilder = resultBuilder; }
public StartState(ArgsDefinition definition, PreParserResultBuilder resultBuilder) { Debug.Assert(definition != null); Debug.Assert(resultBuilder != null); this.definition = definition; this.resultBuilder = resultBuilder; }
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); }
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); }
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; }
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); }