@malloydata/syntax-highlight 0.0.406 → 0.0.408

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,8 +15,9 @@ export const monarch: Monaco.IMonarchLanguage = {
15
15
  malloy_language: [
16
16
  {include: '@sql_string'},
17
17
  {include: '@comments'},
18
- //{ include: '@tags' },
19
18
  {include: '@strings'},
19
+ {include: '@given'},
20
+ {include: '@percent'},
20
21
  {include: '@numbers'},
21
22
  {include: '@keywords'},
22
23
  {include: '@properties'},
@@ -30,27 +31,75 @@ export const monarch: Monaco.IMonarchLanguage = {
30
31
  ],
31
32
  sql_string: [
32
33
  [
33
- /(\b[A-Za-z_][A-Za-z_0-9]*)(\s*\.\s*)(sql)(\s*\(\s*)(""")/,
34
+ /(\b[A-Za-z_][A-Za-z_0-9]*)(\s*\.\s*)((?:sql))(\s*\(\s*)(""")/,
34
35
  [
35
- 'variable.other',
36
+ 'variable.other.malloy',
36
37
  '',
37
- 'keyword.control.sql',
38
+ 'keyword.control.sql.malloy',
38
39
  '',
39
40
  {
40
- next: '@sql_end',
41
+ next: '@sql_end_0',
41
42
  nextEmbedded: 'sql',
42
- token: 'punctuation.sql.block.open',
43
+ token: 'punctuation.definition.string.begin.sql.malloy',
44
+ },
45
+ ],
46
+ ],
47
+ [
48
+ /(\b[A-Za-z_][A-Za-z_0-9]*)(\s*\.\s*)((?:sql))(\s*\(\s*)(")/,
49
+ [
50
+ 'variable.other.malloy',
51
+ '',
52
+ 'keyword.control.sql.malloy',
53
+ '',
54
+ {
55
+ next: '@sql_end_1',
56
+ nextEmbedded: 'sql',
57
+ token: 'punctuation.definition.string.begin.sql.malloy',
58
+ },
59
+ ],
60
+ ],
61
+ [
62
+ /(\b[A-Za-z_][A-Za-z_0-9]*)(\s*\.\s*)((?:sql))(\s*\(\s*)(')/,
63
+ [
64
+ 'variable.other.malloy',
65
+ '',
66
+ 'keyword.control.sql.malloy',
67
+ '',
68
+ {
69
+ next: '@sql_end_2',
70
+ nextEmbedded: 'sql',
71
+ token: 'punctuation.definition.string.begin.sql.malloy',
43
72
  },
44
73
  ],
45
74
  ],
46
75
  ],
47
- sql_end: [
76
+ sql_end_0: [
48
77
  [
49
78
  /"""/,
50
79
  {
51
80
  next: '@pop',
52
81
  nextEmbedded: '@pop',
53
- token: 'punctuation.sql.block.close',
82
+ token: 'punctuation.definition.string.end.sql.malloy',
83
+ },
84
+ ],
85
+ ],
86
+ sql_end_1: [
87
+ [
88
+ /"/,
89
+ {
90
+ next: '@pop',
91
+ nextEmbedded: '@pop',
92
+ token: 'punctuation.definition.string.end.sql.malloy',
93
+ },
94
+ ],
95
+ ],
96
+ sql_end_2: [
97
+ [
98
+ /'/,
99
+ {
100
+ next: '@pop',
101
+ nextEmbedded: '@pop',
102
+ token: 'punctuation.definition.string.end.sql.malloy',
54
103
  },
55
104
  ],
56
105
  ],
@@ -66,187 +115,166 @@ export const monarch: Monaco.IMonarchLanguage = {
66
115
  ],
67
116
  comment_line_double_slash_end: [
68
117
  [/\n/, {next: '@pop', token: 'comment.line.double.slash'}],
69
- {include: '@tag_values'},
70
- [/[^\n(]+/, 'comment.line.double.slash'],
71
- [/[\n(]/, 'comment.line.double.slash'],
118
+ [/[^\n]+/, 'comment.line.double.slash'],
119
+ [/[\n]/, 'comment.line.double.slash'],
72
120
  ],
73
121
  comment_line_double_hyphen_end: [
74
122
  [/\n/, {next: '@pop', token: 'comment.line.double.hyphen'}],
75
123
  [/[^\n]+/, 'comment.line.double.hyphen'],
76
124
  [/[\n]/, 'comment.line.double.hyphen'],
77
125
  ],
78
- tags: [
126
+ strings: [
79
127
  [
80
- /^([ \t]*)##\|/,
128
+ /\bf'''/,
81
129
  {
82
- next: '@comment_line_double_slash_end',
83
- token: 'support.type.property.name.json',
130
+ next: '@string_quoted_filter_malloy_end',
131
+ token: 'string.quoted.filter.malloy',
84
132
  },
85
133
  ],
86
134
  [
87
- /^([ \t]*)#\|/,
135
+ /\bf"""/,
88
136
  {
89
- next: '@comment_line_double_slash_end',
90
- token: 'support.type.property.name.json',
137
+ next: '@string_quoted_filter_malloy_end_2',
138
+ token: 'string.quoted.filter.malloy',
91
139
  },
92
140
  ],
93
- [/##\n/, 'string.quoted'],
94
- [/#"/, {next: '@comment_line_double_slash_end', token: 'comment.line'}],
95
- [/#\n/, 'string.quoted'],
96
141
  [
97
- /#\s/,
142
+ /\bf'/,
98
143
  {
99
- next: '@comment_line_double_slash_end',
100
- token: 'support.type.property.name.json',
144
+ next: '@string_quoted_filter_malloy_end_3',
145
+ token: 'string.quoted.filter.malloy',
101
146
  },
102
147
  ],
103
148
  [
104
- /##\s/,
149
+ /\bf"/,
105
150
  {
106
- next: '@comment_line_double_slash_end',
107
- token: 'support.type.property.name.json',
151
+ next: '@string_quoted_filter_malloy_end_4',
152
+ token: 'string.quoted.filter.malloy',
108
153
  },
109
154
  ],
110
- [/#/, {next: '@string_quoted_end', token: 'string.quoted'}],
111
- ],
112
- tag_values: [
113
155
  [
114
- /(-)?((?:[^\s=#]+)|(?:"[^#]+"))(?:\s*(=)\s*((?:[^\s=#]+)|(?:"[^#]+")))?/,
115
- [
116
- 'keyword.control.negate',
117
- 'support.type.property.name.json',
118
- 'keyword.operator.comparison.ts',
119
- 'string.quoted',
120
- ],
156
+ /\bf`/,
157
+ {
158
+ next: '@string_quoted_filter_malloy_end_5',
159
+ token: 'string.quoted.filter.malloy',
160
+ },
121
161
  ],
162
+ [
163
+ /\bs'/,
164
+ {
165
+ next: '@string_quoted_raw_single_malloy_end',
166
+ token: 'string.quoted.raw.single.malloy',
167
+ },
168
+ ],
169
+ [
170
+ /\bs"/,
171
+ {
172
+ next: '@string_quoted_raw_double_malloy_end',
173
+ token: 'string.quoted.raw.double.malloy',
174
+ },
175
+ ],
176
+ [
177
+ /[r\/]'/,
178
+ {next: '@string_regexp_malloy_end', token: 'string.regexp.malloy'},
179
+ ],
180
+ [
181
+ /"""/,
182
+ {next: '@string_quoted_triple_malloy_end', token: 'string.quoted'},
183
+ ],
184
+ [/'/, {next: '@string_quoted_single_malloy_end', token: 'string.quoted'}],
185
+ [/"/, {next: '@string_quoted_double_malloy_end', token: 'string.quoted'}],
122
186
  ],
123
- string_quoted_end: [
124
- [/\n/, {next: '@pop', token: 'string.quoted'}],
125
- [/[^\n]+/, 'string.quoted'],
126
- [/[\n]/, 'string.quoted'],
187
+ string_quoted_filter_malloy_end: [
188
+ [/'''/, {next: '@pop', token: 'string.quoted.filter.malloy'}],
189
+ [/[^']+/, 'string.quoted.filter.malloy'],
190
+ [/[']/, 'string.quoted.filter.malloy'],
127
191
  ],
128
- strings: [
129
- [/'/, {next: '@string_quoted_single_end', token: 'string.quoted'}],
130
- [/"/, {next: '@string_quoted_double_end', token: 'string.quoted'}],
131
- [/"""/, {next: '@string_quoted_triple_end', token: 'string.quoted'}],
132
- [/[r\/]'/, {next: '@string_regexp_end', token: 'string.regexp'}],
192
+ string_quoted_filter_malloy_end_2: [
193
+ [/"""/, {next: '@pop', token: 'string.quoted.filter.malloy'}],
194
+ [/[^"]+/, 'string.quoted.filter.malloy'],
195
+ [/["]/, 'string.quoted.filter.malloy'],
196
+ ],
197
+ string_quoted_filter_malloy_end_3: [
198
+ [/'/, {next: '@pop', token: 'string.quoted.filter.malloy'}],
199
+ [/[^']+/, 'string.quoted.filter.malloy'],
200
+ [/[']/, 'string.quoted.filter.malloy'],
201
+ ],
202
+ string_quoted_filter_malloy_end_4: [
203
+ [/"/, {next: '@pop', token: 'string.quoted.filter.malloy'}],
204
+ [/[^"]+/, 'string.quoted.filter.malloy'],
205
+ [/["]/, 'string.quoted.filter.malloy'],
206
+ ],
207
+ string_quoted_filter_malloy_end_5: [
208
+ [/`/, {next: '@pop', token: 'string.quoted.filter.malloy'}],
209
+ [/[^`]+/, 'string.quoted.filter.malloy'],
210
+ [/[`]/, 'string.quoted.filter.malloy'],
211
+ ],
212
+ string_quoted_raw_single_malloy_end: [
213
+ [/'/, {next: '@pop', token: 'string.quoted.raw.single.malloy'}],
214
+ [/[^']+/, 'string.quoted.raw.single.malloy'],
215
+ [/[']/, 'string.quoted.raw.single.malloy'],
216
+ ],
217
+ string_quoted_raw_double_malloy_end: [
218
+ [/"/, {next: '@pop', token: 'string.quoted.raw.double.malloy'}],
219
+ [/[^"]+/, 'string.quoted.raw.double.malloy'],
220
+ [/["]/, 'string.quoted.raw.double.malloy'],
133
221
  ],
134
- string_quoted_single_end: [
222
+ string_regexp_malloy_end: [
223
+ [/'/, {next: '@pop', token: 'string.regexp.malloy'}],
224
+ {include: '@regex_escapes'},
225
+ [/[^'\\]+/, 'string.regexp.malloy'],
226
+ [/['\\]/, 'string.regexp.malloy'],
227
+ ],
228
+ regex_escapes: [[/\\./, 'constant.character.escape']],
229
+ string_quoted_triple_malloy_end: [
230
+ [/"""/, {next: '@pop', token: 'string.quoted'}],
231
+ [/[^"]+/, 'string.quoted.triple.malloy'],
232
+ [/["]/, 'string.quoted.triple.malloy'],
233
+ ],
234
+ string_quoted_single_malloy_end: [
135
235
  [/'/, {next: '@pop', token: 'string.quoted'}],
136
236
  {include: '@escapes'},
137
- [/[^'\\]+/, 'string.quoted.single'],
138
- [/['\\]/, 'string.quoted.single'],
237
+ [/[^'\\]+/, 'string.quoted.single.malloy'],
238
+ [/['\\]/, 'string.quoted.single.malloy'],
139
239
  ],
140
240
  escapes: [[/\\(u[A-Fa-f0-9]{4}|.)/, 'constant.character.escape']],
141
- string_quoted_double_end: [
241
+ string_quoted_double_malloy_end: [
142
242
  [/"/, {next: '@pop', token: 'string.quoted'}],
143
243
  {include: '@escapes'},
144
- [/[^"\\]+/, 'string.quoted.double'],
145
- [/["\\]/, 'string.quoted.double'],
146
- ],
147
- string_quoted_triple_end: [
148
- [/"""/, {next: '@pop', token: 'string.quoted'}],
149
- [/[^"]+/, 'string.quoted.triple'],
150
- [/["]/, 'string.quoted.triple'],
151
- ],
152
- string_regexp_end: [
153
- [/'/, {next: '@pop', token: 'string.regexp'}],
154
- {include: '@regex_escapes'},
155
- [/[^'\\]+/, 'string.regexp'],
156
- [/['\\]/, 'string.regexp'],
244
+ [/[^"\\]+/, 'string.quoted.double.malloy'],
245
+ [/["\\]/, 'string.quoted.double.malloy'],
157
246
  ],
158
- regex_escapes: [[/\\./, 'constant.character.escape']],
247
+ given: [[/\$[A-Za-z_][A-Za-z0-9_]*/, 'variable.parameter.malloy']],
248
+ percent: [[/[0-9]+%/, 'constant.numeric.percentage.malloy']],
159
249
  numbers: [
160
250
  [
161
251
  /(\b((0|[1-9][0-9]*)(E[+-]?[0-9]+|\.[0-9]*)?)|\.[0-9]+)/,
162
252
  'constant.numeric',
163
253
  ],
164
254
  ],
165
- keywords: [
166
- [/\bis\b/, 'keyword.control.is'],
167
- [/\bon\b/, 'keyword.control.on'],
168
- [/\bnot\b/, 'keyword.other.not'],
169
- [/\bor\b/, 'keyword.other.or'],
170
- [/\bdesc\b/, 'keyword.control.desc'],
171
- [/\bby\b/, 'keyword.control.by'],
172
- [/\band\b/, 'keyword.other.and'],
173
- [/\basc\b/, 'keyword.control.asc'],
174
- [/\bfor\b/, 'keyword.other.for'],
175
- [/\belse\b/, 'keyword.other.else'],
176
- [/\bto\b/, 'keyword.other.to'],
177
- [/\bwhen\b/, 'keyword.other.when'],
178
- [/\bpick\b/, 'keyword.other.pick'],
179
- [/\bimport\b/, 'keyword.control.import'],
180
- [/\binternal\b/, 'keyword.control.internal'],
181
- [/\bpublic\b/, 'keyword.control.public'],
182
- [/\bprivate\b/, 'keyword.control.private'],
183
- [/\binclude\b/, 'keyword.control.include'],
184
- [/\bas\b/, 'keyword.control.as'],
185
- [/\bfrom\b/, 'keyword.control.from'],
186
- [/\bexport\b/, 'keyword.control.export'],
187
- [/\bcase\b/, 'keyword.control.case'],
188
- [/\bthen\b/, 'keyword.control.then'],
189
- [/\bend\b/, 'keyword.control.end'],
190
- [/\bfilter\b/, 'keyword.control.filter'],
191
- [/\bin\b/, 'keyword.other.in'],
192
- [/\blike\b/, 'keyword.other.like'],
193
- [/\binner\b/, 'keyword.other.inner'],
194
- [/\bleft\b/, 'keyword.other.left'],
195
- [/\bright\b/, 'keyword.other.right'],
196
- [/\bfull\b/, 'keyword.other.full'],
197
- ],
255
+ keywords: [[/\b(and|for|in|like|not|or|to)\b/, 'keyword.operator.malloy']],
198
256
  properties: [
199
- [/\baccept\b/, 'keyword.control.accept'],
200
- [/\bselect\b/, 'keyword.control.select'],
201
- [/\bconnection\b/, 'keyword.control.connection'],
202
- [/\brun\b/, 'keyword.control.run'],
203
- [/\bextend\b/, 'keyword.control.extend'],
204
- [/\brefine\b/, 'keyword.control.refine'],
205
- [/\baggregate\b/, 'keyword.control.aggregate'],
206
- [/\bsample\b/, 'keyword.control.sample'],
207
- [/\bcalculate\b/, 'keyword.control.calculate'],
208
- [/\btimezone\b/, 'keyword.control.timezone'],
209
- [/\bdimension\b/, 'keyword.control.dimension'],
210
- [/\bexcept\b/, 'keyword.control.except'],
211
- [/\bsource\b/, 'keyword.control.source'],
212
- [/\bgroup_by\b/, 'keyword.control.group_by'],
213
- [/\bdrill\b/, 'keyword.control.drill'],
214
- [/\bgrouped_by\b/, 'keyword.control.grouped_by'],
215
- [/\bhaving\b/, 'keyword.control.having'],
216
- [/\bindex\b/, 'keyword.control.index'],
217
- [/\bjoin_one\b/, 'keyword.control.join_one'],
218
- [/\bwith\b/, 'keyword.control.with'],
219
- [/\bjoin_many\b/, 'keyword.control.join_many'],
220
- [/\bjoin_cross\b/, 'keyword.control.join_cross'],
221
- [/\blimit\b/, 'keyword.control.limit'],
222
- [/\bmeasure\b/, 'keyword.control.measure'],
223
- [/\bnest\b/, 'keyword.control.nest'],
224
- [/\border_by\b/, 'keyword.control.order_by'],
225
- [/\bpartition_by\b/, 'keyword.control.partition_by'],
226
- [/\bprimary_key\b/, 'keyword.control.primary_key'],
227
- [/\bproject\b/, 'keyword.control.project'],
228
- [/\bquery\b/, 'keyword.control.query'],
229
- [/\brename\b/, 'keyword.control.rename'],
230
- [/\btop\b/, 'keyword.control.top'],
231
- [/\bview\b/, 'keyword.control.view'],
232
- [/\bwhere\b/, 'keyword.control.where'],
233
- [/\bdeclare\b/, 'keyword.control.declare'],
234
- [/\btype\b/, 'keyword.control.type'],
235
- [/\bgiven\b/, 'keyword.control.given'],
257
+ [
258
+ /\b(accept|aggregate|calculate|calculation|connection|declare|dimension|drill|except|given|group_by|grouped_by|having|index|join_cross|join_many|join_one|limit|measure|nest|order_by|partition_by|primary_key|query|rename|run|sample|select|timezone|top|type|view|where)(?=:)/,
259
+ 'keyword.control.malloy',
260
+ ],
261
+ [
262
+ /\b(as|asc|by|case|desc|distinct|else|end|export|extend|filter|from|full|has|import|include|inner|internal|is|left|on|pick|private|public|right|source|then|when|with)\b/,
263
+ 'keyword.control.malloy',
264
+ ],
236
265
  ],
237
266
  functions: [
238
267
  [
239
- /\b(count)(\s*\()(distinct)/,
240
- ['entity.name.function', '', 'entity.name.function.modifier'],
268
+ /\b(all|avg|cast|compose|count|exclude|max|min|sum)(\s*\()/,
269
+ ['support.function.malloy', ''],
241
270
  ],
242
271
  [
243
- /\b(ALL|AVG|CAST|COMPOSE|COUNT|EXCLUDE|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE|UNGROUPED)(\s*\()/,
244
- ['entity.name.function', ''],
272
+ /\b([a-zA-Z_][a-zA-Z_0-9]*)(!)(timestamp|number|string|boolean|date|json)?(\s*\()/,
273
+ ['entity.name.function.malloy', '', 'storage.type.malloy', ''],
245
274
  ],
246
- [/\b([a-zA-Z_][a-zA-Z_0-9]*)(\s*\()/, ['entity.name.function', '']],
247
275
  [
248
- /\b([a-zA-Z_][a-zA-Z_0-9]*)(!)(timestamp|number|string|boolean|date)?(\s*\()/,
249
- ['entity.name.function', '', 'entity.name.type', ''],
276
+ /\b([a-zA-Z_][a-zA-Z_0-9]*)(\s*\()/,
277
+ ['entity.name.function.malloy', ''],
250
278
  ],
251
279
  ],
252
280
  datetimes: [
@@ -261,25 +289,24 @@ export const monarch: Monaco.IMonarchLanguage = {
261
289
  ],
262
290
  identifiers_quoted: [[/`[^`]*`/, 'variable.other.quoted']],
263
291
  types: [
264
- [/\bstring\b/, 'entity.name.type.string'],
265
- [/\bnumber\b/, 'entity.name.type.number'],
266
- [/\bdate\b/, 'entity.name.type.date'],
267
- [/\btimestamptz\b/, 'entity.name.type.timestamptz'],
268
- [/\btimestamp\b/, 'entity.name.type.timestamp'],
269
- [/\bboolean\b/, 'entity.name.type.boolean'],
292
+ [
293
+ /\b(boolean|date|json|number|string|timestamp|timestamptz)\b/,
294
+ 'storage.type.malloy',
295
+ ],
270
296
  ],
271
297
  constants: [
272
- [/\bnull\b/, 'constant.language.null'],
273
- [/\btrue\b/, 'constant.language.true'],
274
- [/\bfalse\b/, 'constant.language.false'],
298
+ [/\b(false|now|null|true)\b/, 'constant.language.malloy'],
299
+ [/\bthis\b/, 'variable.language.malloy'],
275
300
  ],
276
301
  timeframes: [
277
302
  [
278
303
  /\b((year|quarter|month|week|day|hour|minute|second)s?)\b/,
279
- 'keyword.other.timeframe',
304
+ 'keyword.other.timeframe.malloy',
280
305
  ],
281
- [/\b(day_of_year|day_of_month)\b/, 'keyword.other.timeframe'],
306
+ [/\b(day_of_year|day_of_month)\b/, 'keyword.other.timeframe.malloy'],
307
+ ],
308
+ identifiers_unquoted: [
309
+ [/\b[A-Za-z_][A-Za-z_0-9]*\b/, 'variable.other.malloy'],
282
310
  ],
283
- identifiers_unquoted: [[/\b[A-Za-z_][A-Za-z_0-9]*\b/, 'variable.other']],
284
311
  },
285
312
  };