The goal is to perform static analysis for sql input, including: syntax checks, checks if tables, columns and functions exist. Combining this with an embedded sqlite runtime and the ability to assert conditions in this runtime, creates a really great dev experience for sql.
Furthermore, I want to be able to show the user high quality error messages with context, explainations and the ability to mute certain diagnostics.
This analysis includes the stages of lexical analysis/tokenisation, the parsing of SQL according to the sqlite documentation1 and the analysis of the resulting constructs.
This post is about the SQL keyword suggestions implementation: If the input contains an identifier at a point at which a SQL keyword was expected, the sqleibniz parser should generate a diagnostic containing a suggestions for a keyword the identifier could be.
However, this diagnostic is really not that useful. The parser knows it expects a keyword and a keyword can only be one of the list of known keywords. The parser thus should propagate this knowledge to the user. Sqleibniz now does exactly this.