Package jline.console.completer
Class ArgumentCompleter.AbstractArgumentDelimiter
- java.lang.Object
-
- jline.console.completer.ArgumentCompleter.AbstractArgumentDelimiter
-
- All Implemented Interfaces:
ArgumentCompleter.ArgumentDelimiter
- Direct Known Subclasses:
ArgumentCompleter.WhitespaceArgumentDelimiter
- Enclosing class:
- ArgumentCompleter
public abstract static class ArgumentCompleter.AbstractArgumentDelimiter extends java.lang.Object implements ArgumentCompleter.ArgumentDelimiter
Abstract implementation of a delimiter that uses theisDelimiter(java.lang.CharSequence, int)method to determine if a particular character should be used as a delimiter.- Author:
- Marc Prud'hommeaux
-
-
Constructor Summary
Constructors Constructor Description AbstractArgumentDelimiter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ArgumentCompleter.ArgumentListdelimit(java.lang.CharSequence buffer, int cursor)Break the specified buffer into individual tokens that can be completed on their own.char[]getEscapeChars()char[]getQuoteChars()booleanisDelimiter(java.lang.CharSequence buffer, int pos)Returns true if the specified character is a whitespace parameter.abstract booleanisDelimiterChar(java.lang.CharSequence buffer, int pos)Returns true if the character at the specified position if a delimiter.booleanisEscapeChar(java.lang.CharSequence buffer, int pos)Check if this character is a valid escape char (i.e.booleanisEscaped(java.lang.CharSequence buffer, int pos)Check if a character is escaped (i.e.booleanisQuoteChar(java.lang.CharSequence buffer, int pos)booleanisQuoted(java.lang.CharSequence buffer, int pos)voidsetEscapeChars(char[] chars)voidsetQuoteChars(char[] chars)
-
-
-
Method Detail
-
setQuoteChars
public void setQuoteChars(char[] chars)
-
getQuoteChars
public char[] getQuoteChars()
-
setEscapeChars
public void setEscapeChars(char[] chars)
-
getEscapeChars
public char[] getEscapeChars()
-
delimit
public ArgumentCompleter.ArgumentList delimit(java.lang.CharSequence buffer, int cursor)
Description copied from interface:ArgumentCompleter.ArgumentDelimiterBreak the specified buffer into individual tokens that can be completed on their own.- Specified by:
delimitin interfaceArgumentCompleter.ArgumentDelimiter- Parameters:
buffer- The buffer to splitcursor- The current position of the cursor in the buffer- Returns:
- The tokens
-
isDelimiter
public boolean isDelimiter(java.lang.CharSequence buffer, int pos)Returns true if the specified character is a whitespace parameter. Check to ensure that the character is not escaped by any ofgetQuoteChars(), and is not escaped by ant of thegetEscapeChars(), and returns true fromisDelimiterChar(java.lang.CharSequence, int).- Specified by:
isDelimiterin interfaceArgumentCompleter.ArgumentDelimiter- Parameters:
buffer- The complete command bufferpos- The index of the character in the buffer- Returns:
- True if the character should be a delimiter
-
isQuoted
public boolean isQuoted(java.lang.CharSequence buffer, int pos)
-
isQuoteChar
public boolean isQuoteChar(java.lang.CharSequence buffer, int pos)
-
isEscapeChar
public boolean isEscapeChar(java.lang.CharSequence buffer, int pos)Check if this character is a valid escape char (i.e. one that has not been escaped)
-
isEscaped
public boolean isEscaped(java.lang.CharSequence buffer, int pos)Check if a character is escaped (i.e. if the previous character is an escape)- Parameters:
buffer- the buffer to check inpos- the position of the character to check- Returns:
- true if the character at the specified position in the given buffer is an escape character and the character immediately preceding it is not an escape character.
-
isDelimiterChar
public abstract boolean isDelimiterChar(java.lang.CharSequence buffer, int pos)Returns true if the character at the specified position if a delimiter. This method will only be called if the character is not enclosed in any of thegetQuoteChars(), and is not escaped by ant of thegetEscapeChars(). To perform escaping manually, overrideisDelimiter(java.lang.CharSequence, int)instead.
-
-