Package org.jline.reader.impl
Class DefaultParser
java.lang.Object
org.jline.reader.impl.DefaultParser
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThe result of a delimited buffer.static classstatic enumNested classes/interfaces inherited from interface org.jline.reader.Parser
Parser.ParseContext -
Field Summary
Fields inherited from interface org.jline.reader.Parser
REGEX_COMMAND, REGEX_VARIABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionblockCommentDelims(DefaultParser.BlockCommentDelims blockCommentDelims) commandGroup(int commandGroup) eofOnEscapedNewLine(boolean eofOnEscapedNewLine) eofOnUnclosedBracket(DefaultParser.Bracket... brackets) eofOnUnclosedQuote(boolean eofOnUnclosedQuote) escapeChars(char[] chars) getCommand(String line) char[]String[]char[]getVariable(String line) booleanisDelimiter(CharSequence buffer, int pos) Returns true if the specified character is a whitespace parameter.booleanisDelimiterChar(CharSequence buffer, int pos) Returns true if the character at the specified position if a delimiter.booleanbooleanbooleanisEscapeChar(char ch) booleanisEscapeChar(CharSequence buffer, int pos) Check if this character is a valid escape char (i.e. one that has not been escaped)booleanisEscaped(CharSequence buffer, int pos) Check if a character is escaped (i.e. if the previous character is an escape)booleanisLineCommentStarted(CharSequence buffer, int pos) booleanisQuoteChar(CharSequence buffer, int pos) booleanisQuoted(CharSequence buffer, int pos) lineCommentDelims(String[] lineCommentDelims) parse(String line, int cursor, Parser.ParseContext context) quoteChars(char[] chars) regexCommand(String regexCommand) regexVariable(String regexVariable) voidsetBlockCommentDelims(DefaultParser.BlockCommentDelims blockCommentDelims) voidsetCommandGroup(int commandGroup) voidsetEofOnEscapedNewLine(boolean eofOnEscapedNewLine) voidsetEofOnUnclosedBracket(DefaultParser.Bracket... brackets) voidsetEofOnUnclosedQuote(boolean eofOnUnclosedQuote) voidsetEscapeChars(char[] chars) voidsetLineCommentDelims(String[] lineCommentDelims) voidsetQuoteChars(char[] chars) voidsetRegexCommand(String regexCommand) voidsetRegexVariable(String regexVariable) booleanvalidCommandName(String name) booleanvalidVariableName(String name)
-
Constructor Details
-
DefaultParser
public DefaultParser()
-
-
Method Details
-
lineCommentDelims
-
blockCommentDelims
-
quoteChars
-
escapeChars
-
eofOnUnclosedQuote
-
eofOnUnclosedBracket
-
eofOnEscapedNewLine
-
regexVariable
-
regexCommand
-
commandGroup
-
setQuoteChars
public void setQuoteChars(char[] chars) -
getQuoteChars
public char[] getQuoteChars() -
setEscapeChars
public void setEscapeChars(char[] chars) -
getEscapeChars
public char[] getEscapeChars() -
setLineCommentDelims
-
getLineCommentDelims
-
setBlockCommentDelims
-
getBlockCommentDelims
-
setEofOnUnclosedQuote
public void setEofOnUnclosedQuote(boolean eofOnUnclosedQuote) -
isEofOnUnclosedQuote
public boolean isEofOnUnclosedQuote() -
setEofOnEscapedNewLine
public void setEofOnEscapedNewLine(boolean eofOnEscapedNewLine) -
isEofOnEscapedNewLine
public boolean isEofOnEscapedNewLine() -
setEofOnUnclosedBracket
-
setRegexVariable
-
setRegexCommand
-
setCommandGroup
public void setCommandGroup(int commandGroup) -
validCommandName
- Specified by:
validCommandNamein interfaceParser
-
validVariableName
- Specified by:
validVariableNamein interfaceParser
-
getCommand
- Specified by:
getCommandin interfaceParser
-
getVariable
- Specified by:
getVariablein interfaceParser
-
parse
-
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 any 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
-
isLineCommentStarted
-
isEscapeChar
public boolean isEscapeChar(char ch) - Specified by:
isEscapeCharin interfaceParser
-
isEscapeChar
Check if this character is a valid escape char (i.e. one that has not been escaped)- 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.
-
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 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 any of thegetEscapeChars(). To perform escaping manually, overrideisDelimiter(java.lang.CharSequence, int)instead.- 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 a delimiter.
-