From 0820b6ae32107bc5382fa899aecd463015a01dbb Mon Sep 17 00:00:00 2001 From: liuxy0551 Date: Sat, 20 Apr 2024 17:24:23 +0800 Subject: [PATCH] fix: #121 customParams use identifier highlight --- src/languages/hive/hive.ts | 5 +++++ src/languages/impala/impala.ts | 5 +++++ src/languages/mysql/mysql.ts | 5 +++++ src/languages/pgsql/pgsql.ts | 5 +++++ src/languages/spark/spark.ts | 5 +++++ src/languages/trino/trino.ts | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/src/languages/hive/hive.ts b/src/languages/hive/hive.ts index d6c854b6..b57dcfdd 100644 --- a/src/languages/hive/hive.ts +++ b/src/languages/hive/hive.ts @@ -509,6 +509,7 @@ export const language = { { include: '@comments' }, { include: '@whitespace' }, { include: '@pseudoColumns' }, + { include: '@customParams' }, { include: '@numbers' }, { include: '@strings' }, { include: '@complexIdentifiers' }, @@ -554,6 +555,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], diff --git a/src/languages/impala/impala.ts b/src/languages/impala/impala.ts index e02ce38e..d4429401 100644 --- a/src/languages/impala/impala.ts +++ b/src/languages/impala/impala.ts @@ -466,6 +466,7 @@ export const language = { { include: '@comments' }, { include: '@whitespace' }, { include: '@pseudoColumns' }, + { include: '@customParams' }, { include: '@numbers' }, { include: '@strings' }, { include: '@complexIdentifiers' }, @@ -501,6 +502,10 @@ export const language = { [/./, TokenClassConsts.COMMENT] ], pseudoColumns: [], + 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], diff --git a/src/languages/mysql/mysql.ts b/src/languages/mysql/mysql.ts index f038d918..3e7e63b5 100644 --- a/src/languages/mysql/mysql.ts +++ b/src/languages/mysql/mysql.ts @@ -905,6 +905,7 @@ export const language = { { include: '@comments' }, { include: '@whitespace' }, { include: '@pseudoColumns' }, + { include: '@customParams' }, { include: '@numbers' }, { include: '@strings' }, { include: '@complexIdentifiers' }, @@ -953,6 +954,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], diff --git a/src/languages/pgsql/pgsql.ts b/src/languages/pgsql/pgsql.ts index 01e6ef36..fcec0c1b 100644 --- a/src/languages/pgsql/pgsql.ts +++ b/src/languages/pgsql/pgsql.ts @@ -968,6 +968,7 @@ export const language = { { include: '@comments' }, { include: '@whitespace' }, { include: '@pseudoColumns' }, + { include: '@customParams' }, { include: '@numbers' }, { include: '@strings' }, { include: '@complexIdentifiers' }, @@ -1006,6 +1007,10 @@ export const language = { pseudoColumns: [ // Not support ], + 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], diff --git a/src/languages/spark/spark.ts b/src/languages/spark/spark.ts index 781e751e..e095da70 100644 --- a/src/languages/spark/spark.ts +++ b/src/languages/spark/spark.ts @@ -684,6 +684,7 @@ export const language = { { include: '@comments' }, { include: '@whitespace' }, { include: '@pseudoColumns' }, + { include: '@customParams' }, { include: '@numbers' }, { include: '@binaries' }, { include: '@strings' }, @@ -730,6 +731,10 @@ export const language = { } ] ], + customParams: [ + [/\${[A-Za-z0-9._-]*}/, TokenClassConsts.VARIABLE], + [/\@\@{[A-Za-z0-9._-]*}/, TokenClassConsts.VARIABLE] + ], numbers: [ // https://spark.apache.org/docs/latest/sql-ref-literals.html#numeric-literal // TODO: Fractional Literals Syntax diff --git a/src/languages/trino/trino.ts b/src/languages/trino/trino.ts index 788e9cbf..93c9b936 100644 --- a/src/languages/trino/trino.ts +++ b/src/languages/trino/trino.ts @@ -630,6 +630,7 @@ export const language = { { include: '@comments' }, { include: '@whitespace' }, { include: '@pseudoColumns' }, + { include: '@customParams' }, { include: '@numbers' }, { include: '@strings' }, { include: '@complexIdentifiers' }, @@ -674,6 +675,10 @@ export const language = { } ] ], + customParams: [ + [/\${[A-Za-z0-9._-]*}/, TokenClassConsts.VARIABLE], + [/\@\@{[A-Za-z0-9._-]*}/, TokenClassConsts.VARIABLE] + ], numbers: [ [/[$][+-]*\d*(\.\d*)?/, TokenClassConsts.NUMBER], [/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/, TokenClassConsts.NUMBER]