Package org.jline.reader
Interface Parser
- All Known Implementing Classes:
DefaultParser
public interface Parser
The Parser interface is responsible for parsing command lines into tokens.
Parsers analyze input strings and break them into words/tokens according to specific syntax rules. They handle features such as quoting, escaping special characters, and comments. The parser is used by the LineReader during tab completion and when accepting a line of input.
Implementations should ideally return CompletingParsedLine
objects
to properly support completion with escaped or quoted words.
The default implementation is DefaultParser
.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault String
getCommand
(String line) default String
getVariable
(String line) default boolean
isEscapeChar
(char ch) default ParsedLine
parse
(String line, int cursor, Parser.ParseContext context) default boolean
validCommandName
(String name) default boolean
validVariableName
(String name)
-
Field Details
-
REGEX_VARIABLE
- See Also:
-
REGEX_COMMAND
- See Also:
-
-
Method Details
-
parse
- Throws:
SyntaxError
-
parse
- Throws:
SyntaxError
-
isEscapeChar
default boolean isEscapeChar(char ch) -
validCommandName
-
validVariableName
-
getCommand
-
getVariable
-