diff --git a/package.json b/package.json index fc4a88ba..00ac76d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monaco-sql-languages", - "version": "0.12.2", + "version": "0.12.3-beta.12", "description": "SQL languages for the Monaco Editor, based on monaco-languages.", "scripts": { "prepublishOnly": "npm run build", @@ -67,7 +67,7 @@ "pre-commit": "npx pretty-quick --staged" }, "dependencies": { - "dt-sql-parser": "4.1.0-beta.4" + "dt-sql-parser": "4.1.0-beta.7" }, "peerDependencies": { "monaco-editor": ">=0.31.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1c3b1e83..4ecc98b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: dt-sql-parser: - specifier: 4.1.0-beta.4 - version: 4.1.0-beta.4(antlr4ng-cli@1.0.7) + specifier: 4.1.0-beta.7 + version: 4.1.0-beta.7(antlr4ng-cli@1.0.7) devDependencies: '@commitlint/cli': specifier: ^17.7.2 @@ -714,8 +714,8 @@ packages: resolution: {integrity: sha512-sCm11ak2oY6DglEPpCB8TixLjWAxd3kJTs6UIcSasNYxXdFPV+YKlye92c8H4kKFqV5qYMIh7d+cYecEg0dIkA==} engines: {node: '>=6'} - dt-sql-parser@4.1.0-beta.4: - resolution: {integrity: sha512-L+Qsw+lv7enkMuhy0XXOm7H63gaajwX7X0RUGCNU8h5xw9Pj5DEWvLcKTS0R+YmO4FzVXOpEzH9e1KkqQaKFaQ==} + dt-sql-parser@4.1.0-beta.7: + resolution: {integrity: sha512-fVQkZfBRMLtRUKQWiCYY8LcfpwG767ihwNIhi9XKtA2CnC7A8ZIJ4f5Ks0fjtsUUwwBAm/lzxqV3Pp4OA1FO9A==} engines: {node: '>=18'} email-addresses@3.1.0: @@ -2703,7 +2703,7 @@ snapshots: find-up: 3.0.0 minimatch: 3.1.2 - dt-sql-parser@4.1.0-beta.4(antlr4ng-cli@1.0.7): + dt-sql-parser@4.1.0-beta.7(antlr4ng-cli@1.0.7): dependencies: antlr4-c3: 3.3.7(antlr4ng-cli@1.0.7) antlr4ng: 2.0.11(antlr4ng-cli@1.0.7) diff --git a/src/languages/flink/flink.ts b/src/languages/flink/flink.ts index 81b4f820..dec89534 100644 --- a/src/languages/flink/flink.ts +++ b/src/languages/flink/flink.ts @@ -292,10 +292,11 @@ export const language = { 'EXP', 'CEIL', 'CEILING', - 'FLOOR', 'SIN', 'SINH', + 'SQRT', 'COS', + 'MOD', 'TAN', 'TANH', 'COT', @@ -335,6 +336,7 @@ export const language = { 'CONCAT', 'CONCAT_WS', 'LPAD', + 'RIGHT', 'RPAD', 'FROM_BASE64', 'TO_BASE64', @@ -343,6 +345,7 @@ export const language = { 'DECODE', 'ENCODE', 'INSTR', + 'LEFT', 'LOCATE', 'PARSE_URL', 'REGEXP', @@ -375,15 +378,17 @@ export const language = { 'TO_TIMESTAMP_LTZ', 'TO_TIMESTAMP', 'CURRENT_WATERMARK', + 'OVERLAPS', // Conditional Functions 'COALESCE', + 'GREATEST', 'IF', 'IFNULL', 'IS_ALPHA', 'IS_DECIMAL', 'IS_DIGIT', - 'GREATEST', 'LEAST', + 'NULLIF', // Type Conversion Functions 'CAST', 'TRY_CAST', @@ -391,7 +396,12 @@ export const language = { // Collection Functions 'CARDINALITY', 'ELEMENT', + 'ARRAY', + 'MAP', 'ARRAY_CONTAINS', + // comparison function + 'EXISTS', + 'IN', // JSON Functions 'JSON_EXISTS', 'JSON_STRING', @@ -404,14 +414,15 @@ export const language = { // Grouping Functions 'GROUP_ID', 'GROUPING', + 'GROUPING_ID', // Hash Functions 'MD5', 'SHA1', + 'SHA2', 'SHA224', 'SHA256', 'SHA384', 'SHA512', - 'SHA2', // Aggregate Functions 'COUNT', 'AVG', @@ -459,7 +470,6 @@ export const language = { 'TIME', 'TIMESTAMP', 'TIMESTAMP_LTZ', - 'INTERVAL', 'ARRAY', 'MULTISET', 'MAP', @@ -467,6 +477,7 @@ export const language = { 'RAW', 'DEC', 'NUMERIC', + 'INT', 'INTERVAL' ], scopeKeywords: ['CASE', 'END', 'WHEN', 'THEN', 'ELSE'], @@ -478,12 +489,14 @@ export const language = { { include: '@comments' }, { include: '@whitespace' }, { include: '@pseudoColumns' }, + { include: '@customParams' }, { include: '@numbers' }, { include: '@strings' }, { include: '@complexIdentifiers' }, { include: '@scopes' }, { include: '@complexDataTypes' }, - [/[;,.]/, TokenClassConsts.DELIMITER], + { include: '@complexFunctions' }, + [/[:;,.]/, TokenClassConsts.DELIMITER], [/[\(\)\[\]\{\}]/, '@brackets'], [ /[\w@#$]+/, @@ -523,6 +536,10 @@ export const language = { } ] ], + customParams: [ + [/\${[A-Za-z0-9._-]*}/, TokenClassConsts.VARIABLE], + [/\@\@{[A-Za-z0-9._-]*}/, TokenClassConsts.VARIABLE] + ], numbers: [ [/0[xX][0-9a-fA-F]*/, TokenClassConsts.NUMBER_HEX], [/[$][+-]*\d*(\.\d*)?/, TokenClassConsts.NUMBER], @@ -550,6 +567,10 @@ export const language = { [/DOUBLE\s+PRECISION\b/i, { token: TokenClassConsts.TYPE }], [/WITHOUT\s+TIME\s+ZONE\b/i, { token: TokenClassConsts.TYPE }], [/WITH\s+LOCAL\s+TIME\s+ZONE\b/i, { token: TokenClassConsts.TYPE }] + ], + complexFunctions: [ + [/NOT\s+IN\b/i, { token: TokenClassConsts.PREDEFINED }], + [/IS\s+JSON\b/i, { token: TokenClassConsts.PREDEFINED }] ] } }; diff --git a/src/languages/hive/hive.ts b/src/languages/hive/hive.ts index 9f18e6a3..151a1bfd 100644 --- a/src/languages/hive/hive.ts +++ b/src/languages/hive/hive.ts @@ -515,7 +515,7 @@ export const language = { { include: '@complexIdentifiers' }, { include: '@scopes' }, { include: '@complexDataTypes' }, - [/[;,.]/, TokenClassConsts.DELIMITER], + [/[:;,.]/, TokenClassConsts.DELIMITER], [/[\(\)\[\]\{\}]/, '@brackets'], [ /[\w@#$]+/, diff --git a/src/languages/impala/impala.ts b/src/languages/impala/impala.ts index 92b71bd2..0991684a 100644 --- a/src/languages/impala/impala.ts +++ b/src/languages/impala/impala.ts @@ -474,7 +474,7 @@ export const language = { { include: '@scopes' }, { include: '@complexDataTypes' }, { include: '@complexOperators' }, - [/[;,.]/, TokenClassConsts.DELIMITER], + [/[:;,.]/, TokenClassConsts.DELIMITER], [/[\(\)\[\]\{\}]/, '@brackets'], [ /[\w@#$]+/, diff --git a/src/languages/mysql/mysql.ts b/src/languages/mysql/mysql.ts index 4545430d..616438c9 100644 --- a/src/languages/mysql/mysql.ts +++ b/src/languages/mysql/mysql.ts @@ -911,7 +911,7 @@ export const language = { { include: '@complexIdentifiers' }, { include: '@scopes' }, { include: '@complexOperators' }, - [/[;,.]/, TokenClassConsts.DELIMITER], + [/[:;,.]/, TokenClassConsts.DELIMITER], [/[\(\)\[\]\{\}]/, '@brackets'], [ /[\w@]+/, diff --git a/src/languages/pgsql/pgsql.ts b/src/languages/pgsql/pgsql.ts index acfb0d69..7c49cd23 100644 --- a/src/languages/pgsql/pgsql.ts +++ b/src/languages/pgsql/pgsql.ts @@ -980,7 +980,7 @@ export const language = { { include: '@complexIdentifiers' }, { include: '@scopes' }, { include: '@complexDataTypes' }, - [/[;,.]/, TokenClassConsts.DELIMITER], + [/[:;,.]/, TokenClassConsts.DELIMITER], [/[\(\)\[\]\{\}]/, '@brackets'], [ /[\w@#$]+/, diff --git a/src/languages/spark/spark.ts b/src/languages/spark/spark.ts index 3d5689df..b5440e90 100644 --- a/src/languages/spark/spark.ts +++ b/src/languages/spark/spark.ts @@ -699,7 +699,7 @@ export const language = { { include: '@complexIdentifiers' }, { include: '@scopes' }, { include: '@complexDataTypes' }, - [/[;,.]/, TokenClassConsts.DELIMITER], + [/[:;,.]/, TokenClassConsts.DELIMITER], [/[\(\)\[\]\{\}]/, '@brackets'], [ /[\w@#$]+/, diff --git a/src/languages/trino/trino.ts b/src/languages/trino/trino.ts index 93c9b936..3d90a391 100644 --- a/src/languages/trino/trino.ts +++ b/src/languages/trino/trino.ts @@ -636,7 +636,7 @@ export const language = { { include: '@complexIdentifiers' }, { include: '@scopes' }, { include: '@complexDataTypes' }, - [/[;,.]/, TokenClassConsts.DELIMITER], + [/[:;,.]/, TokenClassConsts.DELIMITER], [/[\(\)\[\]\{\}]/, '@brackets'], [ /[\w@$-]+/, // https://trino.io/docs/current/language/reserved.html#language-identifiers diff --git a/src/theme/vs-plus/light.ts b/src/theme/vs-plus/light.ts index 78539917..1da1bce6 100644 --- a/src/theme/vs-plus/light.ts +++ b/src/theme/vs-plus/light.ts @@ -8,31 +8,31 @@ export const lightThemeData: editor.IStandaloneThemeData = { base: 'vs', inherit: true, rules: [ - { token: postfixTokenClass(TokenClassConsts.BINARY), foreground: '098658' }, - { token: postfixTokenClass(TokenClassConsts.BINARY_ESCAPE), foreground: '098658' }, - { token: postfixTokenClass(TokenClassConsts.COMMENT), foreground: '008000' }, - { token: postfixTokenClass(TokenClassConsts.COMMENT_QUOTE), foreground: '008000' }, - { token: postfixTokenClass(TokenClassConsts.DELIMITER), foreground: '000000' }, - { token: postfixTokenClass(TokenClassConsts.DELIMITER_CURLY), foreground: '319331' }, - { token: postfixTokenClass(TokenClassConsts.DELIMITER_PAREN), foreground: '0431fa' }, - { token: postfixTokenClass(TokenClassConsts.DELIMITER_SQUARE), foreground: '0431fa' }, - { token: postfixTokenClass(TokenClassConsts.IDENTIFIER), foreground: '001080' }, - { token: postfixTokenClass(TokenClassConsts.IDENTIFIER_QUOTE), foreground: '001080' }, - { token: postfixTokenClass(TokenClassConsts.KEYWORD), foreground: '0000ff' }, - { token: postfixTokenClass(TokenClassConsts.KEYWORD_SCOPE), foreground: 'af00db' }, - { token: postfixTokenClass(TokenClassConsts.NUMBER), foreground: '098658' }, - { token: postfixTokenClass(TokenClassConsts.NUMBER_FLOAT), foreground: '098658' }, - { token: postfixTokenClass(TokenClassConsts.NUMBER_BINARY), foreground: '098658' }, - { token: postfixTokenClass(TokenClassConsts.NUMBER_OCTAL), foreground: '098658' }, - { token: postfixTokenClass(TokenClassConsts.NUMBER_HEX), foreground: '098658' }, - { token: postfixTokenClass(TokenClassConsts.OPERATOR), foreground: '000000' }, - { token: postfixTokenClass(TokenClassConsts.OPERATOR_KEYWORD), foreground: '0000ff' }, - { token: postfixTokenClass(TokenClassConsts.OPERATOR_SYMBOL), foreground: '000000' }, - { token: postfixTokenClass(TokenClassConsts.PREDEFINED), foreground: '795e26' }, - { token: postfixTokenClass(TokenClassConsts.STRING), foreground: 'a31515' }, - { token: postfixTokenClass(TokenClassConsts.STRING_ESCAPE), foreground: 'a31515' }, - { token: postfixTokenClass(TokenClassConsts.TYPE), foreground: '267f99' }, - { token: postfixTokenClass(TokenClassConsts.VARIABLE), foreground: '4fc1ff' } + { token: postfixTokenClass(TokenClassConsts.BINARY), foreground: '45AB5A' }, + { token: postfixTokenClass(TokenClassConsts.BINARY_ESCAPE), foreground: '45AB5A' }, + { token: postfixTokenClass(TokenClassConsts.NUMBER), foreground: '45AB5A' }, + { token: postfixTokenClass(TokenClassConsts.NUMBER_FLOAT), foreground: '45AB5A' }, + { token: postfixTokenClass(TokenClassConsts.NUMBER_BINARY), foreground: '45AB5A' }, + { token: postfixTokenClass(TokenClassConsts.NUMBER_OCTAL), foreground: '45AB5A' }, + { token: postfixTokenClass(TokenClassConsts.NUMBER_HEX), foreground: '45AB5A' }, + { token: postfixTokenClass(TokenClassConsts.COMMENT), foreground: 'B1B4C5' }, + { token: postfixTokenClass(TokenClassConsts.COMMENT_QUOTE), foreground: 'B1B4C5' }, + { token: postfixTokenClass(TokenClassConsts.DELIMITER), foreground: '7D98B1' }, + { token: postfixTokenClass(TokenClassConsts.OPERATOR), foreground: '7D98B1' }, + { token: postfixTokenClass(TokenClassConsts.OPERATOR_SYMBOL), foreground: '7D98B1' }, + { token: postfixTokenClass(TokenClassConsts.DELIMITER_CURLY), foreground: 'B1BB86' }, + { token: postfixTokenClass(TokenClassConsts.DELIMITER_PAREN), foreground: 'B1BB86' }, + { token: postfixTokenClass(TokenClassConsts.DELIMITER_SQUARE), foreground: 'B1BB86' }, + { token: postfixTokenClass(TokenClassConsts.IDENTIFIER), foreground: '201A1A' }, + { token: postfixTokenClass(TokenClassConsts.IDENTIFIER_QUOTE), foreground: '201A1A' }, + { token: postfixTokenClass(TokenClassConsts.KEYWORD), foreground: '3300FF' }, + { token: postfixTokenClass(TokenClassConsts.OPERATOR_KEYWORD), foreground: '3300FF' }, + { token: postfixTokenClass(TokenClassConsts.KEYWORD_SCOPE), foreground: 'E221DA' }, + { token: postfixTokenClass(TokenClassConsts.PREDEFINED), foreground: 'C3771C' }, + { token: postfixTokenClass(TokenClassConsts.STRING), foreground: 'BC1313' }, + { token: postfixTokenClass(TokenClassConsts.STRING_ESCAPE), foreground: 'BC1313' }, + { token: postfixTokenClass(TokenClassConsts.TYPE), foreground: '256FC6' }, + { token: postfixTokenClass(TokenClassConsts.VARIABLE), foreground: '00AD84' } ], colors: {} };