blob: 5495cce67b62b13bf0831528ea64fde4564676ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package io.dico.dicore.command.parameter;
/**
* An interface to process tokens such as quotes
*/
@Deprecated
public interface IArgumentPreProcessor {
/**
* Preprocess the arguments contained within the given ArgumentBuffer.
* If no changes are made, this might return the same buffer.
* Any arguments preceding {@code buffer.getCursor()} will not be affected.
*
* <p>
* If {@code count} is non-negative, it declares a limit on the number of arguments after preprocessing.
* In that case, the buffer's cursor is set to the index of the first argument following processed arguments.
* </p>
*
* @param buffer the argument buffer
* @param count the maximum number of (processed) arguments
* @return the arguments after preprocessing
*/
ArgumentBuffer process(ArgumentBuffer buffer, int count);
IArgumentPreProcessor NONE = (buffer, count) -> buffer;
/**
* Get an IArgumentPreProcessor that merges arguments between any two tokens
*
* @param tokens The tokens that the merged arguments should be enclosed by, in subsequent pairs.
* Example: []{}""
* This would mean the following would be merged: [ hello this is a merged argument]
* @param escapeChar the char that can be used to escape the given tokens
* @return The IArgumentPreProcessor
*/
static IArgumentPreProcessor mergeOnTokens(String tokens, char escapeChar) {
return new ArgumentMergingPreProcessor(tokens, escapeChar);
}
}
|