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:
    ParsedLine, CompletingParsedLine, DefaultParser
    • Method Detail

      • isEscapeChar

        default boolean isEscapeChar​(char ch)
      • validCommandName

        default boolean validCommandName​(java.lang.String name)
      • validVariableName

        default boolean validVariableName​(java.lang.String name)
      • getCommand

        default java.lang.String getCommand​(java.lang.String line)
      • getVariable

        default java.lang.String getVariable​(java.lang.String line)