APIdia Launch Partner
Top Inners Fields Constructors Methods
jdk.internal.org.jline.reader.impl

public Class DefaultParser

extends Object
implements Parser
Class Inheritance
All Implemented Interfaces
jdk.internal.org.jline.reader.Parser
Imports
java.util.*, java.util.function.Predicate, java.util.regex.Matcher, .Pattern, jdk.internal.org.jline.reader.CompletingParsedLine, .EOFError, .ParsedLine, .Parser

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
DefaultParser.ArgumentList

The result of a delimited buffer.

public static class
public static enum
private class

Field Summary

Modifier and TypeField and Description
private DefaultParser.BlockCommentDelims
private char[]
private int
private boolean
private boolean
private char[]
private String[]
private char[]
private char[]
private String
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public DefaultParser
public DefaultParser
commandGroup(int commandGroup)

public DefaultParser
eofOnEscapedNewLine(boolean eofOnEscapedNewLine)

public DefaultParser
public DefaultParser
eofOnUnclosedQuote(boolean eofOnUnclosedQuote)

public DefaultParser
escapeChars(final char[] chars)

public DefaultParser.BlockCommentDelims
public String
public char[]
public String[]
public char[]
public String
private int
handleDelimiterAndGetRawWordLength(StringBuilder current, List<String> words, int rawWordStart, int rawWordCursor, int rawWordLength, int pos)

private boolean
isCommentDelim(final CharSequence buffer, final int pos, final String pattern)

public boolean

Returns:

True if the character should be a delimiter
isDelimiter
(final CharSequence
The complete command buffer
buffer
,
final int
The index of the character in the buffer
pos
)

Returns true if the specified character is a whitespace parameter.

public boolean

Returns:

true if the character at the specified position in the given buffer is a delimiter.
isDelimiterChar
(CharSequence
the buffer to check in
buffer
,
int
the position of the character to check
pos
)

Returns true if the character at the specified position if a delimiter.

public boolean
public boolean
public boolean
public boolean

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.
isEscapeChar
(final CharSequence
the buffer to check in
buffer
,
final int
the position of the character to check
pos
)

Check if this character is a valid escape char (i.e. one that has not been escaped)

public boolean

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.
isEscaped
(final CharSequence
the buffer to check in
buffer
,
final int
the position of the character to check
pos
)

Check if a character is escaped (i.e. if the previous character is an escape)

public boolean
isLineCommentStarted(final CharSequence buffer, final int pos)

public boolean
isQuoteChar(final CharSequence buffer, final int pos)

public boolean
isQuoted(final CharSequence buffer, final int pos)

private boolean
isRawEscapeChar(char key)

private boolean
isRawQuoteChar(char key)

public DefaultParser
lineCommentDelims(final String[] lineCommentDelims)

public ParsedLine
parse(final String line, final int cursor, Parser.ParseContext context)

Implements jdk.internal.org.jline.reader.Parser.parse.

public DefaultParser
quoteChars(final char[] chars)

public DefaultParser
regexCommand(String regexCommand)

public DefaultParser
regexVariable(String regexVariable)

public void
public void
setCommandGroup(int commandGroup)

public void
setEofOnEscapedNewLine(boolean eofOnEscapedNewLine)

public void
public void
setEofOnUnclosedQuote(boolean eofOnUnclosedQuote)

public void
setEscapeChars(final char[] chars)

public void
setLineCommentDelims(String[] lineCommentDelims)

public void
setQuoteChars(final char[] chars)

public void
setRegexCommand(String regexCommand)

public void
setRegexVariable(String regexVariable)

public boolean
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blockCommentDelimsback to summary
private DefaultParser.BlockCommentDelims blockCommentDelims
closingBracketsback to summary
private char[] closingBrackets
commandGroupback to summary
private int commandGroup
eofOnEscapedNewLineback to summary
private boolean eofOnEscapedNewLine
eofOnUnclosedQuoteback to summary
private boolean eofOnUnclosedQuote
escapeCharsback to summary
private char[] escapeChars
lineCommentDelimsback to summary
private String[] lineCommentDelims
openingBracketsback to summary
private char[] openingBrackets
quoteCharsback to summary
private char[] quoteChars
regexCommandback to summary
private String regexCommand
regexVariableback to summary
private String regexVariable

Constructor Detail

DefaultParserback to summary
public DefaultParser()

Method Detail

blockCommentDelimsback to summary
public DefaultParser blockCommentDelims(final DefaultParser.BlockCommentDelims blockCommentDelims)
commandGroupback to summary
public DefaultParser commandGroup(int commandGroup)
eofOnEscapedNewLineback to summary
public DefaultParser eofOnEscapedNewLine(boolean eofOnEscapedNewLine)
eofOnUnclosedBracketback to summary
public DefaultParser eofOnUnclosedBracket(DefaultParser.Bracket... brackets)
eofOnUnclosedQuoteback to summary
public DefaultParser eofOnUnclosedQuote(boolean eofOnUnclosedQuote)
escapeCharsback to summary
public DefaultParser escapeChars(final char[] chars)
getBlockCommentDelimsback to summary
public DefaultParser.BlockCommentDelims getBlockCommentDelims()
getCommandback to summary
public String getCommand(final String line)

Overrides default jdk.internal.org.jline.reader.Parser.getCommand.

Annotations
@Override
getEscapeCharsback to summary
public char[] getEscapeChars()
getLineCommentDelimsback to summary
public String[] getLineCommentDelims()
getQuoteCharsback to summary
public char[] getQuoteChars()
getVariableback to summary
public String getVariable(final String line)

Overrides default jdk.internal.org.jline.reader.Parser.getVariable.

Annotations
@Override
handleDelimiterAndGetRawWordLengthback to summary
private int handleDelimiterAndGetRawWordLength(StringBuilder current, List<String> words, int rawWordStart, int rawWordCursor, int rawWordLength, int pos)
isCommentDelimback to summary
private boolean isCommentDelim(final CharSequence buffer, final int pos, final String pattern)
isDelimiterback to summary
public boolean isDelimiter(final CharSequence buffer, final int pos)

Returns true if the specified character is a whitespace parameter. Check to ensure that the character is not escaped by any of getQuoteChars, and is not escaped by any of the getEscapeChars, and returns true from isDelimiterChar.

Parameters
buffer:CharSequence

The complete command buffer

pos:int

The index of the character in the buffer

Returns:boolean

True if the character should be a delimiter

isDelimiterCharback to summary
public boolean isDelimiterChar(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 the getQuoteChars, and is not escaped by any of the getEscapeChars. To perform escaping manually, override isDelimiter instead.

Parameters
buffer:CharSequence

the buffer to check in

pos:int

the position of the character to check

Returns:boolean

true if the character at the specified position in the given buffer is a delimiter.

isEofOnEscapedNewLineback to summary
public boolean isEofOnEscapedNewLine()
isEofOnUnclosedQuoteback to summary
public boolean isEofOnUnclosedQuote()
isEscapeCharback to summary
public boolean isEscapeChar(char ch)

Overrides default jdk.internal.org.jline.reader.Parser.isEscapeChar.

Annotations
@Override
isEscapeCharback to summary
public boolean isEscapeChar(final CharSequence buffer, final int pos)

Check if this character is a valid escape char (i.e. one that has not been escaped)

Parameters
buffer:CharSequence

the buffer to check in

pos:int

the position of the character to check

Returns:boolean

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.

isEscapedback to summary
public boolean isEscaped(final CharSequence buffer, final int pos)

Check if a character is escaped (i.e. if the previous character is an escape)

Parameters
buffer:CharSequence

the buffer to check in

pos:int

the position of the character to check

Returns:boolean

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.

isLineCommentStartedback to summary
public boolean isLineCommentStarted(final CharSequence buffer, final int pos)
isQuoteCharback to summary
public boolean isQuoteChar(final CharSequence buffer, final int pos)
isQuotedback to summary
public boolean isQuoted(final CharSequence buffer, final int pos)
isRawEscapeCharback to summary
private boolean isRawEscapeChar(char key)
isRawQuoteCharback to summary
private boolean isRawQuoteChar(char key)
lineCommentDelimsback to summary
public DefaultParser lineCommentDelims(final String[] lineCommentDelims)
parseback to summary
public ParsedLine parse(final String line, final int cursor, Parser.ParseContext context)

Implements jdk.internal.org.jline.reader.Parser.parse.

quoteCharsback to summary
public DefaultParser quoteChars(final char[] chars)
regexCommandback to summary
public DefaultParser regexCommand(String regexCommand)
regexVariableback to summary
public DefaultParser regexVariable(String regexVariable)
setBlockCommentDelimsback to summary
public void setBlockCommentDelims(DefaultParser.BlockCommentDelims blockCommentDelims)
setCommandGroupback to summary
public void setCommandGroup(int commandGroup)
setEofOnEscapedNewLineback to summary
public void setEofOnEscapedNewLine(boolean eofOnEscapedNewLine)
setEofOnUnclosedBracketback to summary
public void setEofOnUnclosedBracket(DefaultParser.Bracket... brackets)
setEofOnUnclosedQuoteback to summary
public void setEofOnUnclosedQuote(boolean eofOnUnclosedQuote)
setEscapeCharsback to summary
public void setEscapeChars(final char[] chars)
setLineCommentDelimsback to summary
public void setLineCommentDelims(String[] lineCommentDelims)
setQuoteCharsback to summary
public void setQuoteChars(final char[] chars)
setRegexCommandback to summary
public void setRegexCommand(String regexCommand)
setRegexVariableback to summary
public void setRegexVariable(String regexVariable)
validCommandNameback to summary
public boolean validCommandName(String name)

Overrides default jdk.internal.org.jline.reader.Parser.validCommandName.

Annotations
@Override
validVariableNameback to summary
public boolean validVariableName(String name)

Overrides default jdk.internal.org.jline.reader.Parser.validVariableName.

Annotations
@Override
jdk.internal.org.jline.reader.impl back to summary

public Class DefaultParser.ArgumentList

extends Object
implements ParsedLine, CompletingParsedLine
Class Inheritance
  • java.lang.Object
  • jdk.internal.org.jline.reader.impl.DefaultParser.ArgumentList
All Implemented Interfaces
jdk.internal.org.jline.reader.CompletingParsedLine, jdk.internal.org.jline.reader.ParsedLine

The result of a delimited buffer.
Author
Marc Prud'hommeaux

Field Summary

Modifier and TypeField and Description
private final int
private final String
private final String
private final int
private final int
private final int
private final int
private final List<String>

Constructor Summary

AccessConstructor and Description
public
ArgumentList(final String line, final List<String> words, final int wordIndex, final int wordCursor, final int cursor)
Deprecated

public
ArgumentList(final String
the command line being edited
line
,
final List<String>
the list of words
words
,
final int
the index of the current word in the list of words
wordIndex
,
final int
the cursor position within the current word
wordCursor
,
final int
the cursor position within the line
cursor
,
final String
the opening quote (usually '\"' or '\'') or null
openingQuote
,
final int
the cursor position inside the raw word (i.e. including quotes and escape characters)
rawWordCursor
,
final int
the raw word length, including quotes and escape characters
rawWordLength
)

Method Summary

Modifier and TypeMethod and Description
public int
cursor()

Implements jdk.internal.org.jline.reader.ParsedLine.cursor.

The cursor position within the line.

public CharSequence
public String
line()

Implements jdk.internal.org.jline.reader.ParsedLine.line.

The unparsed line.

public int
public int
public String
word()

Implements jdk.internal.org.jline.reader.ParsedLine.word.

The current word being completed.

public int
wordCursor()

Implements jdk.internal.org.jline.reader.ParsedLine.wordCursor.

The cursor position within the current word.

public int
wordIndex()

Implements jdk.internal.org.jline.reader.ParsedLine.wordIndex.

The index of the current word in the list of words.

public List<String>
words()

Implements jdk.internal.org.jline.reader.ParsedLine.words.

The list of words.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cursorback to summary
private final int cursor
lineback to summary
private final String line
openingQuoteback to summary
private final String openingQuote
rawWordCursorback to summary
private final int rawWordCursor
rawWordLengthback to summary
private final int rawWordLength
wordCursorback to summary
private final int wordCursor
wordIndexback to summary
private final int wordIndex
wordsback to summary
private final List<String> words

Constructor Detail

ArgumentListback to summary
public ArgumentList(final String line, final List<String> words, final int wordIndex, final int wordCursor, final int cursor)

Deprecated

Annotations
@Deprecated
ArgumentListback to summary
public ArgumentList(final String line, final List<String> words, final int wordIndex, final int wordCursor, final int cursor, final String openingQuote, final int rawWordCursor, final int rawWordLength)
Parameters
line:String

the command line being edited

words:List<String>

the list of words

wordIndex:int

the index of the current word in the list of words

wordCursor:int

the cursor position within the current word

cursor:int

the cursor position within the line

openingQuote:String

the opening quote (usually '\"' or '\'') or null

rawWordCursor:int

the cursor position inside the raw word (i.e. including quotes and escape characters)

rawWordLength:int

the raw word length, including quotes and escape characters

Method Detail

cursorback to summary
public int cursor()

Implements jdk.internal.org.jline.reader.ParsedLine.cursor.

Doc from jdk.internal.org.jline.reader.ParsedLine.cursor.

The cursor position within the line.

escapeback to summary
public CharSequence escape(CharSequence candidate, boolean complete)

Implements jdk.internal.org.jline.reader.CompletingParsedLine.escape.

lineback to summary
public String line()

Implements jdk.internal.org.jline.reader.ParsedLine.line.

Doc from jdk.internal.org.jline.reader.ParsedLine.line.

The unparsed line.

rawWordCursorback to summary
public int rawWordCursor()

Implements jdk.internal.org.jline.reader.CompletingParsedLine.rawWordCursor.

Annotations
@Override
rawWordLengthback to summary
public int rawWordLength()

Implements jdk.internal.org.jline.reader.CompletingParsedLine.rawWordLength.

Annotations
@Override
wordback to summary
public String word()

Implements jdk.internal.org.jline.reader.ParsedLine.word.

Doc from jdk.internal.org.jline.reader.ParsedLine.word.

The current word being completed. If the cursor is after the last word, an empty string is returned.

wordCursorback to summary
public int wordCursor()

Implements jdk.internal.org.jline.reader.ParsedLine.wordCursor.

Doc from jdk.internal.org.jline.reader.ParsedLine.wordCursor.

The cursor position within the current word.

wordIndexback to summary
public int wordIndex()

Implements jdk.internal.org.jline.reader.ParsedLine.wordIndex.

Doc from jdk.internal.org.jline.reader.ParsedLine.wordIndex.

The index of the current word in the list of words.

wordsback to summary
public List<String> words()

Implements jdk.internal.org.jline.reader.ParsedLine.words.

Doc from jdk.internal.org.jline.reader.ParsedLine.words.

The list of words.

jdk.internal.org.jline.reader.impl back to summary

public Class DefaultParser.BlockCommentDelims

extends Object
Class Inheritance
  • java.lang.Object
  • jdk.internal.org.jline.reader.impl.DefaultParser.BlockCommentDelims

Field Summary

Modifier and TypeField and Description
private final String
private final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
public String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

endback to summary
private final String end
startback to summary
private final String start

Constructor Detail

BlockCommentDelimsback to summary
public BlockCommentDelims(String start, String end)

Method Detail

getEndback to summary
public String getEnd()
getStartback to summary
public String getStart()
jdk.internal.org.jline.reader.impl back to summary

public final Enum DefaultParser.Bracket

extends Enum<DefaultParser.Bracket>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final DefaultParser.Bracket
public static final DefaultParser.Bracket
public static final DefaultParser.Bracket
public static final DefaultParser.Bracket

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static DefaultParser.Bracket
public static DefaultParser.Bracket[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ANGLEback to summary
public static final DefaultParser.Bracket ANGLE
CURLYback to summary
public static final DefaultParser.Bracket CURLY
ROUNDback to summary
public static final DefaultParser.Bracket ROUND
SQUAREback to summary
public static final DefaultParser.Bracket SQUARE

Constructor Detail

Bracketback to summary
private Bracket()

Method Detail

valueOfback to summary
public static DefaultParser.Bracket valueOf(String name)
valuesback to summary
public static DefaultParser.Bracket[] values()
jdk.internal.org.jline.reader.impl back to summary

private Class DefaultParser.BracketChecker

extends Object
Class Inheritance
  • java.lang.Object
  • jdk.internal.org.jline.reader.impl.DefaultParser.BracketChecker

Field Summary

Modifier and TypeField and Description
private int
private int
private List<Integer>
private String
private int

Constructor Summary

AccessConstructor and Description
public
BracketChecker(int cursor)

Method Summary

Modifier and TypeMethod and Description
private int
bracketId(final char[] brackets, final CharSequence buffer, final int pos)

public void
check(final CharSequence buffer, final int pos)

public String
public String
public String
public int
public boolean
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cursorback to summary
private int cursor
missingOpeningBracketback to summary
private int missingOpeningBracket
nestedback to summary
private List<Integer> nested
nextClosingBracketback to summary
private String nextClosingBracket
openBracketsback to summary
private int openBrackets

Constructor Detail

BracketCheckerback to summary
public BracketChecker(int cursor)

Method Detail

bracketIdback to summary
private int bracketId(final char[] brackets, final CharSequence buffer, final int pos)
checkback to summary
public void check(final CharSequence buffer, final int pos)
getMissingClosingBracketsback to summary
public String getMissingClosingBrackets()
getMissingOpeningBracketback to summary
public String getMissingOpeningBracket()
getNextClosingBracketback to summary
public String getNextClosingBracket()
getOpenBracketsback to summary
public int getOpenBrackets()
isClosingBracketMissingback to summary
public boolean isClosingBracketMissing()
isOpeningBracketMissingback to summary
public boolean isOpeningBracketMissing()