Class ArgumentsParser
An argument parser for commands.
Namespace: TehGM.Wolfringo.Commands.Parsing
Assembly: Wolfringo.Commands.dll
Syntax
public class ArgumentsParser : IArgumentsParser
Constructors
| Improve this Doc View SourceArgumentsParser()
Create a new instance of default parser using default options.
Declaration
public ArgumentsParser()
ArgumentsParser(ArgumentsParserOptions)
Create a new instance of default parser.
Declaration
public ArgumentsParser(ArgumentsParserOptions options)
Parameters
Type | Name | Description |
---|---|---|
Arguments |
options | Options to use with this parser. |
Properties
| Improve this Doc View SourceBaseMarker
Base marker to use by default.
Declaration
public char BaseMarker { get; }
Property Value
Type | Description |
---|---|
System. |
Remarks
Base marker is used by default, and will be skipped inside of a nested block.
Base marker must be contained as a key in Block
Defaults to space.
BlockMarkers
Argument start and end markers.
Declaration
public IDictionary<char, char> BlockMarkers { get; }
Property Value
Type | Description |
---|---|
System. |
Remarks
By default, following markers are used to split arguments:
Start: ' ', End: ' '
Start: '"', End: '"'
Start: '(', End: ')'
Start: '[', End: ']'
InitialBlockSizeAllocation
Initial size allocated for an argument.
Declaration
public int InitialBlockSizeAllocation { get; }
Property Value
Type | Description |
---|---|
System. |
Remarks
Arguments
Defaults to 8.
Options
Options used by this parser.
Declaration
protected ArgumentsParserOptions Options { get; }
Property Value
Type | Description |
---|---|
Arguments |
Methods
| Improve this Doc View SourceParseArguments(String, Int32)
Parses commands from input.
Declaration
public virtual IEnumerable<string> ParseArguments(string input, int startIndex)
Parameters
Type | Name | Description |
---|---|---|
System. |
input | Command input. |
System. |
startIndex | Index at which to start parsing. |
Returns
Type | Description |
---|---|
System. |
Enumerable of found arguments. |
ParseBlock(String, ref Int32, Nullable<Char>, ref ICollection<String>)
Parses a block.
Declaration
protected virtual void ParseBlock(string input, ref int cursor, char? terminator, ref ICollection<string> results)
Parameters
Type | Name | Description |
---|---|---|
System. |
input | Entire command input. |
System. |
cursor | Current parser position. |
System. |
terminator | The character to end the block with. |
System. |
results | Parsed arguments. |