Package org.springframework.shell.jline
Class ExtendedDefaultParser
java.lang.Object
org.springframework.shell.jline.ExtendedDefaultParser
- All Implemented Interfaces:
org.jline.reader.Parser
Shameful copy-paste of JLine's
DefaultParser
which
creates CompletingParsedLine
.-
Nested Class Summary
Modifier and TypeClassDescriptionclass
The result of a delimited buffer.Nested classes/interfaces inherited from interface org.jline.reader.Parser
org.jline.reader.Parser.ParseContext
-
Field Summary
Fields inherited from interface org.jline.reader.Parser
REGEX_COMMAND, REGEX_VARIABLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionchar[]
char[]
boolean
isDelimiter
(CharSequence buffer, int pos) Returns true if the specified character is a whitespace parameter.boolean
isDelimiterChar
(CharSequence buffer, int pos) Returns true if the character at the specified position if a delimiter.boolean
boolean
boolean
isEscapeChar
(CharSequence buffer, int pos) Check if this character is a valid escape char (i.e.boolean
isEscaped
(CharSequence buffer, int pos) Check if a character is escaped (i.e.boolean
isQuoteChar
(CharSequence buffer, int pos) boolean
isQuoted
(CharSequence buffer, int pos) org.jline.reader.ParsedLine
void
setEofOnEscapedNewLine
(boolean eofOnEscapedNewLine) void
setEofOnUnclosedQuote
(boolean eofOnUnclosedQuote) void
setEscapeChars
(char[] chars) void
setQuoteChars
(char[] chars) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jline.reader.Parser
getCommand, getVariable, isEscapeChar, parse, validCommandName, validVariableName
-
Constructor Details
-
ExtendedDefaultParser
public ExtendedDefaultParser()
-
-
Method Details
-
setQuoteChars
public void setQuoteChars(char[] chars) -
getQuoteChars
public char[] getQuoteChars() -
setEscapeChars
public void setEscapeChars(char[] chars) -
getEscapeChars
public char[] getEscapeChars() -
setEofOnUnclosedQuote
public void setEofOnUnclosedQuote(boolean eofOnUnclosedQuote) -
isEofOnUnclosedQuote
public boolean isEofOnUnclosedQuote() -
setEofOnEscapedNewLine
public void setEofOnEscapedNewLine(boolean eofOnEscapedNewLine) -
isEofOnEscapedNewLine
public boolean isEofOnEscapedNewLine() -
parse
public org.jline.reader.ParsedLine parse(String line, int cursor, org.jline.reader.Parser.ParseContext context) - Specified by:
parse
in interfaceorg.jline.reader.Parser
-
isDelimiter
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)
.- Parameters:
buffer
- The complete command bufferpos
- The index of the character in the buffer- Returns:
- True if the character should be a delimiter
-
isQuoted
-
isQuoteChar
-
isEscapeChar
Check if this character is a valid escape char (i.e. one that has not been escaped) -
isEscaped
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
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.
-