Wolfringo Wolfringo
Wolfringo Wolfringo
Wolfringo (c) 2020 TehGM
DocFX, DiscordFX theme.
Search Results for

    Class ArgumentsParser

    An argument parser for commands.

    Inheritance
    System.Object
    ArgumentsParser
    Implements
    IArgumentsParser
    Namespace: TehGM.Wolfringo.Commands.Parsing
    Assembly: Wolfringo.Commands.dll
    Syntax
    public class ArgumentsParser : IArgumentsParser

    Constructors

    | Improve this Doc View Source

    ArgumentsParser()

    Create a new instance of default parser using default options.

    Declaration
    public ArgumentsParser()
    | Improve this Doc View Source

    ArgumentsParser(ArgumentsParserOptions)

    Create a new instance of default parser.

    Declaration
    public ArgumentsParser(ArgumentsParserOptions options)
    Parameters
    Type Name Description
    ArgumentsParserOptions options

    Options to use with this parser.

    Properties

    | Improve this Doc View Source

    BaseMarker

    Base marker to use by default.

    Declaration
    public char BaseMarker { get; }
    Property Value
    Type Description
    System.Char
    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 BlockMarkers.

    Defaults to space.

    | Improve this Doc View Source

    BlockMarkers

    Argument start and end markers.

    Declaration
    public IDictionary<char, char> BlockMarkers { get; }
    Property Value
    Type Description
    System.Collections.Generic.IDictionary<System.Char, System.Char>
    Remarks

    By default, following markers are used to split arguments:
    Start: ' ', End: ' '
    Start: '"', End: '"'
    Start: '(', End: ')'
    Start: '[', End: ']'

    | Improve this Doc View Source

    InitialBlockSizeAllocation

    Initial size allocated for an argument.

    Declaration
    public int InitialBlockSizeAllocation { get; }
    Property Value
    Type Description
    System.Int32
    Remarks

    ArgumentsParser uses a new list of System.Char for each argument, and allocates initial size. A good initial size is big enough to contain most commonly used arguments, but small enough to not allocate too much memory unnecessarily.

    Defaults to 8.

    | Improve this Doc View Source

    Options

    Options used by this parser.

    Declaration
    protected ArgumentsParserOptions Options { get; }
    Property Value
    Type Description
    ArgumentsParserOptions

    Methods

    | Improve this Doc View Source

    ParseArguments(String, Int32)

    Parses commands from input.

    Declaration
    public virtual IEnumerable<string> ParseArguments(string input, int startIndex)
    Parameters
    Type Name Description
    System.String input

    Command input.

    System.Int32 startIndex

    Index at which to start parsing.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.String>

    Enumerable of found arguments.

    | Improve this Doc View Source

    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.String input

    Entire command input.

    System.Int32 cursor

    Current parser position.

    System.Nullable<System.Char> terminator

    The character to end the block with.

    System.Collections.Generic.ICollection<System.String> results

    Parsed arguments.

    Implements

    IArgumentsParser