Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The main idea is to extend existing org.apache.flink.table.client.cli.SqlMultiLineParser . => No need to use Flink SQL parser
It should check the input if all quotes, comments, hints, brackets (square and round) are closed otherwise it throws new EOFError  - normal behavior in jline in case input should be continued on a new line.
During need to keep track of cursor states if it is a comment, keyword, quoted string.Also during this parse it is required to split input into words and pass these words further to jline according to contract. (Jline will use these words also to evaluate completion candidates)

Code Block
java
java
public enum State {
        DEFAULT,
        KEYWORD, // used only for highlighting
        SINGLE_QUOTED,
        SQL_IDENTIFIER_QUOTED,
        HINT,
        LINE_COMMENTED,
        BLOCK_COMMENTED;
    }


This track could be used to answer a question at what state parser by the end of a query.
Also such track, if there is recorded state for every cursor position, could be used to do highlighting.

To do highlighting it is necessary to implement  org.jline.reader.impl.DefaultHighlighter.
From parser it could receive a track of state for each position and do highlighting.
Colors for different states are going to be defined in a separate SyntaxHighlightStyle class.

...