@malloydata/syntax-highlight 0.0.409 → 0.0.411
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.
|
@@ -13,7 +13,6 @@ export const monarch: Monaco.IMonarchLanguage = {
|
|
|
13
13
|
tokenizer: {
|
|
14
14
|
root: [{include: '@malloy_language'}],
|
|
15
15
|
malloy_language: [
|
|
16
|
-
{include: '@sql_string'},
|
|
17
16
|
{include: '@comments'},
|
|
18
17
|
{include: '@strings'},
|
|
19
18
|
{include: '@given'},
|
|
@@ -29,80 +28,6 @@ export const monarch: Monaco.IMonarchLanguage = {
|
|
|
29
28
|
{include: '@timeframes'},
|
|
30
29
|
{include: '@identifiers_unquoted'},
|
|
31
30
|
],
|
|
32
|
-
sql_string: [
|
|
33
|
-
[
|
|
34
|
-
/(\b[A-Za-z_][A-Za-z_0-9]*)(\s*\.\s*)((?:sql))(\s*\(\s*)(""")/,
|
|
35
|
-
[
|
|
36
|
-
'variable.other.malloy',
|
|
37
|
-
'',
|
|
38
|
-
'keyword.control.sql.malloy',
|
|
39
|
-
'',
|
|
40
|
-
{
|
|
41
|
-
next: '@sql_end_0',
|
|
42
|
-
nextEmbedded: 'sql',
|
|
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',
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
],
|
|
75
|
-
],
|
|
76
|
-
sql_end_0: [
|
|
77
|
-
[
|
|
78
|
-
/"""/,
|
|
79
|
-
{
|
|
80
|
-
next: '@pop',
|
|
81
|
-
nextEmbedded: '@pop',
|
|
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',
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
],
|
|
106
31
|
comments: [
|
|
107
32
|
[/\/\*/, {next: '@comment_block_end', token: 'comment.block'}],
|
|
108
33
|
[/\/\//, {next: '@comment_line_double_slash_end', token: 'comment.line'}],
|
|
@@ -287,7 +212,7 @@ export const monarch: Monaco.IMonarchLanguage = {
|
|
|
287
212
|
'constant.numeric.date',
|
|
288
213
|
],
|
|
289
214
|
],
|
|
290
|
-
identifiers_quoted: [[/`[^`]*`/, 'variable.other.quoted']],
|
|
215
|
+
identifiers_quoted: [[/`[^`]*`/, 'variable.other.quoted.malloy']],
|
|
291
216
|
types: [
|
|
292
217
|
[
|
|
293
218
|
/\b(boolean|date|json|number|string|timestamp|timestamptz)\b/,
|
|
@@ -93,34 +93,42 @@
|
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
95
|
"sql-string": {
|
|
96
|
-
"comment": "SQL-ness is the .sql()
|
|
96
|
+
"comment": "SQL-ness is the .sql() CONTEXT, not the delimiter — any string argument to connection.sql(...) is SQL (grammar: connectionId DOT SQL OPAREN (sqlString|shortString) CPAREN; connectionId is an `id`). Two NESTED rules so the string can sit on a different line from `.sql(` — a single begin regex cannot span the newline. The OUTER rule opens at `connection.sql(` and closes at the matching `)`; the INNER rule matches the string argument wherever it lands. connection matches an `id`: a Unicode identifier ([\\p{Alphabetic}_]… mirrors the lexer's ID_CHAR) or a backtick-quoted name. The inner quote absorbs an optional raw `s` prefix but captures only the quote, so the \\1 end back-reference closes all of '…', \"…\", s'…', s\"…\", and \"\"\"…\"\"\". #malloy-in-sql gives blocks their %{ } interpolation (harmless inside short/raw strings, where it is vanishingly rare).",
|
|
97
97
|
"patterns": [
|
|
98
98
|
{
|
|
99
|
-
"begin": "(
|
|
100
|
-
"end": "\\
|
|
99
|
+
"begin": "(`[^`]*`|[\\p{Alphabetic}_][\\p{Alphabetic}_0-9]*)(\\s*\\.\\s*)((?i:sql))(\\s*\\(\\s*)",
|
|
100
|
+
"end": "\\)",
|
|
101
101
|
"beginCaptures": {
|
|
102
102
|
"1": {
|
|
103
103
|
"name": "variable.other.malloy"
|
|
104
104
|
},
|
|
105
105
|
"3": {
|
|
106
106
|
"name": "keyword.control.sql.malloy"
|
|
107
|
-
},
|
|
108
|
-
"5": {
|
|
109
|
-
"name": "punctuation.definition.string.begin.sql.malloy"
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
"endCaptures": {
|
|
113
|
-
"0": {
|
|
114
|
-
"name": "punctuation.definition.string.end.sql.malloy"
|
|
115
107
|
}
|
|
116
108
|
},
|
|
117
109
|
"name": "meta.embedded.block.sql.malloy",
|
|
118
110
|
"patterns": [
|
|
119
111
|
{
|
|
120
|
-
"
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
"begin": "(?:[sS]\\s*)?(\"\"\"|\"|')",
|
|
113
|
+
"end": "\\1",
|
|
114
|
+
"beginCaptures": {
|
|
115
|
+
"1": {
|
|
116
|
+
"name": "punctuation.definition.string.begin.sql.malloy"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"endCaptures": {
|
|
120
|
+
"0": {
|
|
121
|
+
"name": "punctuation.definition.string.end.sql.malloy"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"patterns": [
|
|
125
|
+
{
|
|
126
|
+
"include": "#malloy-in-sql"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"include": "source.sql"
|
|
130
|
+
}
|
|
131
|
+
]
|
|
124
132
|
}
|
|
125
133
|
]
|
|
126
134
|
}
|
|
@@ -173,7 +181,7 @@
|
|
|
173
181
|
"patterns": [
|
|
174
182
|
{
|
|
175
183
|
"match": "`[^`]*`",
|
|
176
|
-
"name": "variable.other.quoted"
|
|
184
|
+
"name": "variable.other.quoted.malloy"
|
|
177
185
|
}
|
|
178
186
|
]
|
|
179
187
|
},
|
|
@@ -245,7 +253,7 @@
|
|
|
245
253
|
]
|
|
246
254
|
},
|
|
247
255
|
"tags": {
|
|
248
|
-
"comment": "Malloy annotations are ROUTED (annotation-prefix.ts parsePrefix; docs.malloydata.dev/documentation/language/tags). The sigil is ##? then an optional block '|'; the route follows it (up to first whitespace) and decides how the content reads. Tag routes — empty (MOTLY) and the claimed sigils ! @ : — carry tag property-language → tag styling. The documentation route (\") and app-defined bracketed routes ( () <> [] {} ) carry prose/markdown/JSON → documentation styling. Routes apply identically to single-line (#/##) and block (#|/##|) forms. The doc-route fragment is repeated per rule because TextMate has no regex variables; (?!docroute) on the tag rules both implements the split and keeps the prefix-sharing begin scanner from dropping the shorter tag begins.
|
|
256
|
+
"comment": "Malloy annotations are ROUTED (annotation-prefix.ts parsePrefix; docs.malloydata.dev/documentation/language/tags). The sigil is ##? then an optional block '|'; the route follows it (up to first whitespace) and decides how the content reads. Tag routes — empty (MOTLY) and the claimed sigils ! @ : — carry tag property-language → tag styling. The documentation route (\") and app-defined bracketed routes ( () <> [] {} ) carry prose/markdown/JSON → documentation styling. Routes apply identically to single-line (#/##) and block (#|/##|) forms. The doc-route fragment is repeated per rule because TextMate has no regex variables; (?!docroute) on the tag rules both implements the split and keeps the prefix-sharing begin scanner from dropping the shorter tag begins. Tag-route bodies (line and block alike) embed source.motly — the MOTLY tag-property language (@malloydata/motly-ts-parser) — so keys, values, references, @-literals, arrays, and nested blocks highlight as MOTLY.",
|
|
249
257
|
"patterns": [
|
|
250
258
|
{
|
|
251
259
|
"begin": "^([ \\t]*)(##\\|(?:\"|\\([^\\s)]*\\)|<[^\\s>]*>|\\[[^\\s\\]]*\\]|\\{[^\\s}]*\\}))",
|
|
@@ -278,7 +286,7 @@
|
|
|
278
286
|
"name": "meta.annotation.block.malloy",
|
|
279
287
|
"patterns": [
|
|
280
288
|
{
|
|
281
|
-
"include": "
|
|
289
|
+
"include": "source.motly"
|
|
282
290
|
}
|
|
283
291
|
]
|
|
284
292
|
},
|
|
@@ -313,7 +321,7 @@
|
|
|
313
321
|
"name": "meta.annotation.block.malloy",
|
|
314
322
|
"patterns": [
|
|
315
323
|
{
|
|
316
|
-
"include": "
|
|
324
|
+
"include": "source.motly"
|
|
317
325
|
}
|
|
318
326
|
]
|
|
319
327
|
},
|
|
@@ -338,37 +346,11 @@
|
|
|
338
346
|
"name": "meta.annotation.line.malloy",
|
|
339
347
|
"patterns": [
|
|
340
348
|
{
|
|
341
|
-
"include": "
|
|
342
|
-
}
|
|
343
|
-
]
|
|
344
|
-
}
|
|
345
|
-
],
|
|
346
|
-
"repository": {
|
|
347
|
-
"tag-content": {
|
|
348
|
-
"patterns": [
|
|
349
|
-
{
|
|
350
|
-
"match": "\"[^\"#]*\"",
|
|
351
|
-
"name": "string.quoted.double.malloy"
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
"match": "=",
|
|
355
|
-
"name": "keyword.operator.assignment.malloy"
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
"match": "-(?=[A-Za-z_])",
|
|
359
|
-
"name": "keyword.operator.negation.malloy"
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
"match": "[0-9][A-Za-z_0-9.]*",
|
|
363
|
-
"name": "constant.numeric.malloy"
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
"match": "[A-Za-z_][A-Za-z_0-9.]*",
|
|
367
|
-
"name": "entity.name.tag.malloy"
|
|
349
|
+
"include": "source.motly"
|
|
368
350
|
}
|
|
369
351
|
]
|
|
370
352
|
}
|
|
371
|
-
|
|
353
|
+
]
|
|
372
354
|
},
|
|
373
355
|
"strings": {
|
|
374
356
|
"comment": "Order matters: f-/s-/r- prefixed forms begin one char earlier than a bare quote so they win by start position; among same-start ties the triple forms are listed before the single/double forms. Filter (f...) and raw (s...) bodies are opaque in v1 — no inner patterns. The bare triple string has NO interpolation pattern, so %{ } inside it stays plain string text (interpolation is only legal inside .sql(), handled by #sql-string).",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/syntax-highlight",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.411",
|
|
4
4
|
"description": "A package to simplify the process of developing, testing, and syncnig Malloy syntax highlighting grammars",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
|
+
"@malloydata/motly-ts-parser": "^0.9.0",
|
|
30
31
|
"@types/jasmine": "^4.3.5",
|
|
31
32
|
"http-server": "^14.1.1",
|
|
32
33
|
"jasmine-core": "^5.1.1",
|