Package revxrsal.commands.util.tokenize
Class QuotedStringTokenizer
java.lang.Object
revxrsal.commands.util.tokenize.QuotedStringTokenizer
- All Implemented Interfaces:
ArgumentParser
Parser for converting a quoted string into a list of arguments.
Grammar is roughly (yeah, this is not really a proper grammar but it gives you an idea of what's happening:
WHITESPACE = Character.isWhiteSpace(codePoint) CHAR := (all unicode) ESCAPE := '\' CHAR QUOTE = ' | " UNQUOTED_ARG := (CHAR | ESCAPE)+ WHITESPACE QUOTED_ARG := QUOTE (CHAR | ESCAPE)+ QUOTE ARGS := ((UNQUOTED_ARG | QUOTED_ARG) WHITESPACE+)+
-
Field Summary
Fields inherited from interface revxrsal.commands.command.ArgumentParser
NO_QUOTES, QUOTES
-
Method Summary
-
Field Details
-
INSTANCE
-
-
Method Details
-
parse
Description copied from interface:ArgumentParser
Parses the string and returns anArgumentStack
for it.- Specified by:
parse
in interfaceArgumentParser
- 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.
-