Package revxrsal.commands.command
Interface ArgumentParser
- All Known Implementing Classes:
QuotedStringTokenizer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a parser that receives strings and converts them into
collection-like
ArgumentStack
that is consumed by resolvers.
Argument parsers allow to customize the tokenizing logic of strings, such as allowing quotes, skipping extra whitespace, etc.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ArgumentParser
An argument parser that only parses strings by spaces, and does not respect quotes.static final ArgumentParser
An argument parser that parses strings by quotes and skips extra whitespace. -
Method Summary
-
Field Details
-
QUOTES
An argument parser that parses strings by quotes and skips extra whitespace. -
NO_QUOTES
An argument parser that only parses strings by spaces, and does not respect quotes.
-
-
Method Details
-
parse
Parses the string and returns anArgumentStack
for it.- Parameters:
arguments
- String to parse. This string is guaranteed never to be null or empty.- Returns:
- The argument stack. You should create this with
ArgumentStack.empty()
or other methods - Throws:
ArgumentParseException
- An exception to throw in case of errors while parsing the string. It is optional to throw this.
-