@tenzir/codemirror-lang-tql 0.5.1 → 0.5.3
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.
- package/README.md +11 -3
- package/dist/index.cjs +7 -4
- package/dist/index.js +7 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -197,6 +197,7 @@ The highlight query's captures become these tags (`tqlCaptureTags`):
|
|
|
197
197
|
| `punctuation` | `tags.punctuation` |
|
|
198
198
|
| `punctuation.bracket` | `tags.bracket` |
|
|
199
199
|
| `punctuation.delimiter` | `tags.separator` |
|
|
200
|
+
| `punctuation.special` | `tags.special(tags.punctuation)` |
|
|
200
201
|
|
|
201
202
|
A capture without an entry takes the tag of the nearest capture it refines, so
|
|
202
203
|
`function.builtin` would be a `function`. Pipeline operators (`function.operator`),
|
|
@@ -233,11 +234,18 @@ const extensions = [
|
|
|
233
234
|
];
|
|
234
235
|
```
|
|
235
236
|
|
|
237
|
+
An entry covers the captures that refine it, so `punctuation: null` also
|
|
238
|
+
leaves out the braces around an expression in a format string
|
|
239
|
+
(`punctuation.special`), which then take the color of the string. To color
|
|
240
|
+
them apart, give them their tag back with
|
|
241
|
+
`"punctuation.special": tqlCaptureTags["punctuation.special"]`.
|
|
242
|
+
|
|
236
243
|
## Editing
|
|
237
244
|
|
|
238
|
-
- **Quote pairing:** `closeBrackets()` pairs `(`, `[`, `{`,
|
|
239
|
-
after the
|
|
240
|
-
with up to 8 `#`.
|
|
245
|
+
- **Quote pairing:** `closeBrackets()` pairs `(`, `[`, `{`, and `"`, also
|
|
246
|
+
after the format prefix `f` and the byte and raw prefixes `b`, `r`, and
|
|
247
|
+
`br` with up to 8 `#`. TQL has no single-quoted strings, so `'` doesn't
|
|
248
|
+
pair. tree-sitter-tql parses a string without its closing quote
|
|
241
249
|
as a string that runs to the end of the document, as TQL's strings may span
|
|
242
250
|
lines, so typing the closing quote doesn't insert a pair. The same goes for a
|
|
243
251
|
`/*` comment without its `*/`.
|
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var brackets = ";; Auto-generated by tenzir/tree-sitter-tql/scripts/generate-bra
|
|
|
8
8
|
|
|
9
9
|
var folds = ";; Auto-generated by tenzir/tree-sitter-tql/scripts/generate-folds.mjs. DO NOT EDIT.\n\n[\n (then_block)\n (else_block)\n (pipeline_block)\n (pipeline_expression)\n (match_statement)\n (match_arm)\n (list)\n (record)\n (frontmatter)\n] @fold\n";
|
|
10
10
|
|
|
11
|
-
var highlights = ";; Auto-generated by tenzir/tree-sitter-tql/scripts/generate-highlights.mjs. DO NOT EDIT.\n\n[\n \"let\"\n \"if\"\n \"else\"\n \"match\"\n \"and\"\n \"or\"\n \"not\"\n \"move\"\n \"in\"\n \"this\"\n \"?\"\n \".\"\n \"...\"\n \"
|
|
11
|
+
var highlights = ";; Auto-generated by tenzir/tree-sitter-tql/scripts/generate-highlights.mjs. DO NOT EDIT.\n\n[\n \"let\"\n \"if\"\n \"else\"\n \"match\"\n \"and\"\n \"or\"\n \"not\"\n \"move\"\n \"in\"\n \"this\"\n \"?\"\n \".\"\n \"...\"\n \":\"\n] @keyword\n\n[\n \"+\"\n \"-\"\n \"*\"\n \"/\"\n] @keyword\n\n\"_\" @variable.builtin\n\n\"null\" @constant.builtin\n\n[\n \"true\"\n \"false\"\n] @boolean\n\n(dollar_var) @variable.builtin\n(global_sigil) @keyword\n(metadata_sigil) @keyword\n(meta_selector) @attribute\n(number) @number\n(string) @string\n(format_expr) @string\n(ip) @constant.ip\n(subnet) @constant.subnet\n(time) @number.time\n(duration) @number.duration\n(frontmatter_open) @comment\n(frontmatter_close) @comment\n(comment) @comment\n\n(invocation\n operator: (entity) @function.operator)\n(call_expression\n (entity) @function.call)\n(call_expression\n method: (entity) @function.method)\n((identifier) @variable.builtin (#match? @variable.builtin \"^\\$[A-Za-z_]\\w*$\"))\n(then_block\n [\"{\" \"}\"] @punctuation.bracket)\n(else_block\n [\"{\" \"}\"] @punctuation.bracket)\n(pipeline_block\n [\"{\" \"}\"] @punctuation.bracket)\n(pipeline_expression\n [\"{\" \"}\"] @punctuation.bracket)\n(match_statement\n [\"{\" \"}\"] @punctuation.bracket)\n(match_arm\n [\"{\" \"}\"] @punctuation.bracket)\n(record\n [\"{\" \"}\"] @punctuation.bracket)\n(format_replacement\n [\"{\" \"}\"] @punctuation.special)\n\n[\n \"(\"\n \")\"\n \"[\"\n \"]\"\n] @punctuation.bracket\n\n[\n \",\"\n] @punctuation.delimiter\n\n[\n \"=\"\n \"=>\"\n \"|\"\n \"..\"\n \"::\"\n \"==\"\n \"!=\"\n \">\"\n \">=\"\n \"<\"\n \"<=\"\n] @operator\n";
|
|
12
12
|
|
|
13
13
|
var indents = ";; Auto-generated by tenzir/tree-sitter-tql/scripts/generate-indents.mjs. DO NOT EDIT.\n\n[\n (then_block)\n (else_block)\n (pipeline_block)\n (pipeline_expression)\n (match_statement)\n (match_arm)\n (list)\n (record)\n] @indent\n\n[\n \"}\"\n \"]\"\n] @outdent\n\n[\n (string)\n (format_text)\n (comment)\n (frontmatter_body)\n] @indent.auto\n";
|
|
14
14
|
|
|
@@ -50,6 +50,7 @@ const tqlCaptureTags = {
|
|
|
50
50
|
punctuation: highlight.tags.punctuation,
|
|
51
51
|
"punctuation.bracket": highlight.tags.bracket,
|
|
52
52
|
"punctuation.delimiter": highlight.tags.separator,
|
|
53
|
+
"punctuation.special": highlight.tags.special(highlight.tags.punctuation),
|
|
53
54
|
};
|
|
54
55
|
/** The entry of `table` for `capture` or the nearest capture it refines. */
|
|
55
56
|
const lookupCapture = (table, capture) => {
|
|
@@ -575,7 +576,7 @@ class TqlParse {
|
|
|
575
576
|
|
|
576
577
|
/** The queries of tree-sitter-tql that `tql` uses unless given others. */
|
|
577
578
|
const tqlQueries = { highlights, indents, folds, brackets, injections };
|
|
578
|
-
const
|
|
579
|
+
const hashedPrefixes = ["b", "r", "br"].flatMap((prefix) => {
|
|
579
580
|
return Array.from({ length: 9 }, (_, hashes) => prefix + "#".repeat(hashes));
|
|
580
581
|
});
|
|
581
582
|
/**
|
|
@@ -596,8 +597,10 @@ function tql(treeSitter, options = {}) {
|
|
|
596
597
|
const data = language.defineLanguageFacet({
|
|
597
598
|
commentTokens: { line: "//", block: { open: "/*", close: "*/" } },
|
|
598
599
|
closeBrackets: {
|
|
599
|
-
//
|
|
600
|
-
|
|
600
|
+
// TQL has no single-quoted strings.
|
|
601
|
+
brackets: ["(", "[", "{", '"'],
|
|
602
|
+
// Byte and raw strings take up to 8 hashes, as in tree-sitter-tql.
|
|
603
|
+
stringPrefixes: ["f", ...hashedPrefixes],
|
|
601
604
|
},
|
|
602
605
|
indentOnInput: /^\s*[}\]]$/,
|
|
603
606
|
});
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var brackets = ";; Auto-generated by tenzir/tree-sitter-tql/scripts/generate-bra
|
|
|
6
6
|
|
|
7
7
|
var folds = ";; Auto-generated by tenzir/tree-sitter-tql/scripts/generate-folds.mjs. DO NOT EDIT.\n\n[\n (then_block)\n (else_block)\n (pipeline_block)\n (pipeline_expression)\n (match_statement)\n (match_arm)\n (list)\n (record)\n (frontmatter)\n] @fold\n";
|
|
8
8
|
|
|
9
|
-
var highlights = ";; Auto-generated by tenzir/tree-sitter-tql/scripts/generate-highlights.mjs. DO NOT EDIT.\n\n[\n \"let\"\n \"if\"\n \"else\"\n \"match\"\n \"and\"\n \"or\"\n \"not\"\n \"move\"\n \"in\"\n \"this\"\n \"?\"\n \".\"\n \"...\"\n \"
|
|
9
|
+
var highlights = ";; Auto-generated by tenzir/tree-sitter-tql/scripts/generate-highlights.mjs. DO NOT EDIT.\n\n[\n \"let\"\n \"if\"\n \"else\"\n \"match\"\n \"and\"\n \"or\"\n \"not\"\n \"move\"\n \"in\"\n \"this\"\n \"?\"\n \".\"\n \"...\"\n \":\"\n] @keyword\n\n[\n \"+\"\n \"-\"\n \"*\"\n \"/\"\n] @keyword\n\n\"_\" @variable.builtin\n\n\"null\" @constant.builtin\n\n[\n \"true\"\n \"false\"\n] @boolean\n\n(dollar_var) @variable.builtin\n(global_sigil) @keyword\n(metadata_sigil) @keyword\n(meta_selector) @attribute\n(number) @number\n(string) @string\n(format_expr) @string\n(ip) @constant.ip\n(subnet) @constant.subnet\n(time) @number.time\n(duration) @number.duration\n(frontmatter_open) @comment\n(frontmatter_close) @comment\n(comment) @comment\n\n(invocation\n operator: (entity) @function.operator)\n(call_expression\n (entity) @function.call)\n(call_expression\n method: (entity) @function.method)\n((identifier) @variable.builtin (#match? @variable.builtin \"^\\$[A-Za-z_]\\w*$\"))\n(then_block\n [\"{\" \"}\"] @punctuation.bracket)\n(else_block\n [\"{\" \"}\"] @punctuation.bracket)\n(pipeline_block\n [\"{\" \"}\"] @punctuation.bracket)\n(pipeline_expression\n [\"{\" \"}\"] @punctuation.bracket)\n(match_statement\n [\"{\" \"}\"] @punctuation.bracket)\n(match_arm\n [\"{\" \"}\"] @punctuation.bracket)\n(record\n [\"{\" \"}\"] @punctuation.bracket)\n(format_replacement\n [\"{\" \"}\"] @punctuation.special)\n\n[\n \"(\"\n \")\"\n \"[\"\n \"]\"\n] @punctuation.bracket\n\n[\n \",\"\n] @punctuation.delimiter\n\n[\n \"=\"\n \"=>\"\n \"|\"\n \"..\"\n \"::\"\n \"==\"\n \"!=\"\n \">\"\n \">=\"\n \"<\"\n \"<=\"\n] @operator\n";
|
|
10
10
|
|
|
11
11
|
var indents = ";; Auto-generated by tenzir/tree-sitter-tql/scripts/generate-indents.mjs. DO NOT EDIT.\n\n[\n (then_block)\n (else_block)\n (pipeline_block)\n (pipeline_expression)\n (match_statement)\n (match_arm)\n (list)\n (record)\n] @indent\n\n[\n \"}\"\n \"]\"\n] @outdent\n\n[\n (string)\n (format_text)\n (comment)\n (frontmatter_body)\n] @indent.auto\n";
|
|
12
12
|
|
|
@@ -48,6 +48,7 @@ const tqlCaptureTags = {
|
|
|
48
48
|
punctuation: tags.punctuation,
|
|
49
49
|
"punctuation.bracket": tags.bracket,
|
|
50
50
|
"punctuation.delimiter": tags.separator,
|
|
51
|
+
"punctuation.special": tags.special(tags.punctuation),
|
|
51
52
|
};
|
|
52
53
|
/** The entry of `table` for `capture` or the nearest capture it refines. */
|
|
53
54
|
const lookupCapture = (table, capture) => {
|
|
@@ -573,7 +574,7 @@ class TqlParse {
|
|
|
573
574
|
|
|
574
575
|
/** The queries of tree-sitter-tql that `tql` uses unless given others. */
|
|
575
576
|
const tqlQueries = { highlights, indents, folds, brackets, injections };
|
|
576
|
-
const
|
|
577
|
+
const hashedPrefixes = ["b", "r", "br"].flatMap((prefix) => {
|
|
577
578
|
return Array.from({ length: 9 }, (_, hashes) => prefix + "#".repeat(hashes));
|
|
578
579
|
});
|
|
579
580
|
/**
|
|
@@ -594,8 +595,10 @@ function tql(treeSitter, options = {}) {
|
|
|
594
595
|
const data = defineLanguageFacet({
|
|
595
596
|
commentTokens: { line: "//", block: { open: "/*", close: "*/" } },
|
|
596
597
|
closeBrackets: {
|
|
597
|
-
//
|
|
598
|
-
|
|
598
|
+
// TQL has no single-quoted strings.
|
|
599
|
+
brackets: ["(", "[", "{", '"'],
|
|
600
|
+
// Byte and raw strings take up to 8 hashes, as in tree-sitter-tql.
|
|
601
|
+
stringPrefixes: ["f", ...hashedPrefixes],
|
|
599
602
|
},
|
|
600
603
|
indentOnInput: /^\s*[}\]]$/,
|
|
601
604
|
});
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.5.
|
|
10
|
+
"version": "0.5.3",
|
|
11
11
|
"description": "Tenzir Query Language (TQL) support for CodeMirror, backed by tree-sitter-tql",
|
|
12
12
|
"keywords": [
|
|
13
13
|
"codemirror",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@rollup/plugin-typescript": "^12.3.1",
|
|
50
50
|
"rollup": "^4.68.2",
|
|
51
51
|
"rollup-plugin-dts": "^6.5.1",
|
|
52
|
-
"tree-sitter-tql": "1.
|
|
52
|
+
"tree-sitter-tql": "1.5.1",
|
|
53
53
|
"tslib": "^2.9.1",
|
|
54
54
|
"typescript": "^5.9.3",
|
|
55
55
|
"web-tree-sitter": "^0.26.13"
|