feat: add generic SQL language support#469
Open
liuxy0551 wants to merge 6 commits into
Open
Conversation
- Add INTERSECT and EXCEPT to queryNoWith rule for set operations - Remove 173 unused KW_* lexer rules for removed features (views, indexes, grants, transactions, stored procedures, window functions, triggers, etc.) - Trim nonReserved list to only keywords actually used in parser rules - Remove unused UNICODE_STRING and DIGIT_IDENTIFIER lexer rules - Keyword count reduced from 263 to 90 (close to ~100 target) - All 197 test suites pass (5627 tests)
- Remove core structural keywords from nonReserved so they cannot be used as identifiers: SELECT, FROM, WHERE, CREATE, TABLE, INSERT, UPDATE, DELETE, DROP, ALTER, SET, JOIN, GROUP, HAVING, ORDER, ON, UNION, INTERSECT, EXCEPT, INTO, NOT, AND, OR, IN, BETWEEN, LIKE, IS, EXISTS, CASE, WHEN, THEN, ELSE, END, CAST, AS, DISTINCT, PRIMARY, CONSTRAINT, REFERENCES, COLUMN, UNIQUE, CHECK, FOREIGN, RENAME, RECURSIVE, WITH, NULL, ESCAPE, NULLIF - Add DIGIT_IDENTIFIER lexer token for identifiers starting with a digit (e.g. 123abc, 1st_column) - Include DIGIT_IDENTIFIER in identifier rule alternatives
…tion - Add GenericSqlListener and GenericSqlVisitor exports to src/index.ts - Add GenericSQLOptions interface with configurable diagnostics flag - Override validate() to return empty array when diagnostics disabled - Export GenericSQLOptions type from src/index.ts
- Add exitQuerySpecification for QUERY_RESULT entity tracking - Add exitSelectItem for column entity collection in SELECT clauses - Track wildcard columns (ColumnDeclareType.ALL) for * and table.* - Track expression columns with alias support (ColumnDeclareType.EXPRESSION) - Stage previously untracked files (errorListener, splitListener, semanticContextCollector)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
基于 Trino 语法裁剪,新增 GenericSQL 通用 SQL 方言,只保留核心 DML/DDL 语法。
支持的语法
移除的语法
视图、索引、存储过程、窗口函数、权限管理、事务控制等厂商扩展语法。
主要变更
src/grammar/generic/GenericSql.g4语法文件src/parser/generic/解析器实现test/parser/generic/测试用例相关地址
预览地址:https://liuxy0551.github.io/monaco-sql-languages
monaco-sql-languages PR:DTStack/monaco-sql-languages#217
测试