Package org.jline.builtins
Class SyntaxHighlighter.Parser
java.lang.Object
org.jline.builtins.SyntaxHighlighter.Parser
- Enclosing class:
SyntaxHighlighter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private String[]
private String
private boolean
private boolean
private String
private static final char
private boolean
private String[]
private String
private CharSequence
private List
<SyntaxHighlighter.ParsedToken> private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate String
balancedDelimiter
(CharSequence buffer, int pos) private boolean
isDelimiter
(CharSequence buffer, int pos, String delimiter) private boolean
isEscapeChar
(char ch) private boolean
isEscapeChar
(CharSequence buffer, int pos) Check if this character is a valid escape char (i.e.private boolean
isEscaped
(CharSequence buffer, int pos) Check if a character is escaped (i.e.private boolean
isLineCommentDelimiter
(CharSequence buffer, int pos) void
parse
(CharSequence line) void
reset()
void
setBalancedDelimiters
(String tokenName, String[] args) void
setBlockCommentDelimiters
(String tokenName, String[] args) void
setLineCommentDelimiters
(String tokenName, String[] args) private CharSequence
startWithSubstring
(CharSequence line, int pos)
-
Field Details
-
escapeChar
private static final char escapeChar- See Also:
-
blockCommentTokenName
-
blockCommentDelimiters
-
lineCommentTokenName
-
lineCommentDelimiters
-
balancedDelimiterTokenName
-
balancedDelimiters
-
balancedDelimiter
-
tokens
-
startWith
-
tokenStart
private int tokenStart -
blockComment
private boolean blockComment -
lineComment
private boolean lineComment -
balancedQuoted
private boolean balancedQuoted
-
-
Constructor Details
-
Parser
public Parser()
-
-
Method Details
-
setBlockCommentDelimiters
-
setLineCommentDelimiters
-
setBalancedDelimiters
-
reset
public void reset() -
parse
-
startWithSubstring
-
getTokens
-
balancedDelimiter
-
isDelimiter
-
isLineCommentDelimiter
-
isEscapeChar
private boolean isEscapeChar(char ch) -
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.
-