Skip to content

Commit

Permalink
feat: highlight keywords of condition expression (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
HaydenOrz authored Nov 3, 2023
1 parent f24e4ff commit a9f6578
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/flinksql/flinksql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ export const language = <languages.IMonarchLanguage>{
'NUMERIC',
'INTERVAL'
],
scopeKeywords: ['CASE', 'END', 'WHEN', 'THEN', 'ELSE'],
pseudoColumns: [
// Not support
],
Expand All @@ -796,6 +797,7 @@ export const language = <languages.IMonarchLanguage>{
/[\w@#$]+/,
{
cases: {
'@scopeKeywords': TokenClassConsts.KEYWORD_SCOPE,
'@operators': TokenClassConsts.OPERATOR_KEYWORD,
'@typeKeywords': TokenClassConsts.TYPE,
'@builtinVariables': TokenClassConsts.VARIABLE,
Expand Down Expand Up @@ -850,8 +852,7 @@ export const language = <languages.IMonarchLanguage>{
],
scopes: [
[/(EXECUTE\s+)?BEGIN\s+STATEMENT\s+SET/i, TokenClassConsts.KEYWORD_SCOPE],
[/(EXECUTE\s+)?STATEMENT\s+SET\s+BEGIN/i, TokenClassConsts.KEYWORD_SCOPE],
[/END\b/i, { token: TokenClassConsts.KEYWORD_SCOPE }]
[/(EXECUTE\s+)?STATEMENT\s+SET\s+BEGIN/i, TokenClassConsts.KEYWORD_SCOPE]
],
complexDataTypes: [
[/DOUBLE\s+PRECISION\b/i, { token: TokenClassConsts.TYPE }],
Expand Down
2 changes: 2 additions & 0 deletions src/hivesql/hivesql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ export const language = <languages.IMonarchLanguage>{
'STRUCT',
'UNIONTYPE'
],
scopeKeywords: ['CASE', 'END', 'WHEN', 'THEN', 'ELSE'],
pseudoColumns: [
// Not support
],
Expand All @@ -708,6 +709,7 @@ export const language = <languages.IMonarchLanguage>{
/[\w@#$]+/,
{
cases: {
'@scopeKeywords': TokenClassConsts.KEYWORD_SCOPE,
'@operators': TokenClassConsts.OPERATOR_KEYWORD,
'@typeKeywords': TokenClassConsts.TYPE,
'@builtinVariables': TokenClassConsts.VARIABLE,
Expand Down
2 changes: 2 additions & 0 deletions src/sparksql/sparksql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,7 @@ export const language = <languages.IMonarchLanguage>{
'STRUCT',
'MAP'
],
scopeKeywords: ['CASE', 'END', 'WHEN', 'THEN', 'ELSE'],
pseudoColumns: [
// Not support
],
Expand All @@ -860,6 +861,7 @@ export const language = <languages.IMonarchLanguage>{
/[\w@#$]+/,
{
cases: {
'@scopeKeywords': TokenClassConsts.KEYWORD_SCOPE,
'@operators': TokenClassConsts.OPERATOR_KEYWORD,
'@typeKeywords': TokenClassConsts.TYPE,
'@builtinVariables': TokenClassConsts.VARIABLE,
Expand Down
2 changes: 2 additions & 0 deletions src/trinosql/trinosql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ export const language = <languages.IMonarchLanguage>{
// UUID
'UUID'
],
scopeKeywords: ['CASE', 'END', 'WHEN', 'THEN', 'ELSE'],
pseudoColumns: [
// Not support
],
Expand All @@ -759,6 +760,7 @@ export const language = <languages.IMonarchLanguage>{
/[\w@$-]+/, // https://trino.io/docs/current/language/reserved.html#language-identifiers
{
cases: {
'@scopeKeywords': TokenClassConsts.KEYWORD_SCOPE,
'@operators': TokenClassConsts.OPERATOR_KEYWORD,
'@typeKeywords': TokenClassConsts.TYPE,
'@builtinVariables': TokenClassConsts.VARIABLE,
Expand Down

0 comments on commit a9f6578

Please sign in to comment.