@gram-data/tree-sitter-gram 0.3.4 → 0.3.5
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/bindings/node/binding_test.js +18 -19
- package/editors/zed/extension.toml +2 -2
- package/editors/zed/languages/gram/highlights.scm +28 -10
- package/editors/zed/languages/gram/locals.scm +9 -0
- package/grammar.js +13 -4
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/darwin-x64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/linux-arm64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/linux-x64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/win32-arm64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/win32-x64/@gram-data+tree-sitter-gram.node +0 -0
- package/queries/highlights.scm +28 -10
- package/queries/locals.scm +9 -0
- package/src/grammar.json +83 -5
- package/src/node-types.json +60 -24
- package/src/parser.c +1846 -2060
- package/tree-sitter-gram.wasm +0 -0
- package/tree-sitter.json +5 -4
|
@@ -8,30 +8,29 @@ test("can load grammar", () => {
|
|
|
8
8
|
assert.doesNotThrow(() => parser.setLanguage(require(".")));
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
test("
|
|
11
|
+
test("parses a simple node pattern", () => {
|
|
12
12
|
const Parser = require("tree-sitter");
|
|
13
13
|
const GramLang = require(".");
|
|
14
14
|
const parser = new Parser();
|
|
15
15
|
parser.setLanguage(GramLang);
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const tree = parser.parse("(a)");
|
|
18
|
+
const pattern = tree.rootNode.child(0);
|
|
19
|
+
assert(pattern, "root should have a pattern child");
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
// Find the symbol 'a' in the pattern
|
|
22
|
+
function findSymbol(node, text) {
|
|
23
|
+
if (node.isNamed && node.type === "symbol" && node.text === text) {
|
|
24
|
+
return node;
|
|
25
|
+
}
|
|
26
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
27
|
+
const result = findSymbol(node.child(i), text);
|
|
28
|
+
if (result) return result;
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
27
32
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
assert(
|
|
31
|
-
const annotations2 = ap2.childForFieldName("annotations");
|
|
32
|
-
assert(annotations2, "annotations node should exist");
|
|
33
|
-
const first2 = annotations2.child(0);
|
|
34
|
-
assert.strictEqual(first2?.type, "property_annotation", "@ form should be property_annotation");
|
|
35
|
-
assert(first2?.childForFieldName("key"), "property_annotation should have key field");
|
|
36
|
-
assert(first2?.childForFieldName("value"), "property_annotation should have value field");
|
|
33
|
+
const symbol = findSymbol(pattern, "a");
|
|
34
|
+
assert(symbol, "pattern should contain symbol 'a'");
|
|
35
|
+
assert.strictEqual(symbol.type, "symbol");
|
|
37
36
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
id = "gram"
|
|
2
2
|
name = "Gram Language Support"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.5"
|
|
4
4
|
schema_version = 1
|
|
5
5
|
authors = ["Gram Data Contributors"]
|
|
6
6
|
description = "Support for Gram notation - composable data patterns"
|
|
@@ -8,4 +8,4 @@ description = "Support for Gram notation - composable data patterns"
|
|
|
8
8
|
# path = "grammars/tree-sitter-gram"
|
|
9
9
|
[grammars.gram]
|
|
10
10
|
repository = "https://github.com/gram-data/tree-sitter-gram"
|
|
11
|
-
rev = "
|
|
11
|
+
rev = "869488b6bbea325b4c4153a7a6bee97df7931a58"
|
|
@@ -21,30 +21,48 @@
|
|
|
21
21
|
; Reference identifier: pattern_reference (FR-001)
|
|
22
22
|
(pattern_reference identifier: (_) @variable)
|
|
23
23
|
|
|
24
|
-
;
|
|
24
|
+
; Symbols and identifiers (generic; definition/reference/tag captured above)
|
|
25
|
+
(symbol) @variable
|
|
26
|
+
|
|
27
|
+
; Definition-like identifiers and labels (FR-001): @type
|
|
28
|
+
; These must come AFTER generic symbol rule to take priority
|
|
29
|
+
|
|
30
|
+
; Labels (symbols and quoted names in labels nodes)
|
|
31
|
+
(labels (symbol) @type)
|
|
32
|
+
(labels (quoted_name) @type)
|
|
33
|
+
|
|
34
|
+
; Annotation identifiers and labels
|
|
35
|
+
(identified_annotation identifier: (_) @type)
|
|
36
|
+
(identified_annotation labels: (labels (symbol) @type))
|
|
37
|
+
(identified_annotation labels: (labels (quoted_name) @type))
|
|
38
|
+
|
|
39
|
+
; Subject, node, and relationship pattern definitions (FR-001): @type
|
|
25
40
|
; subject/node subject is _subject (use wildcard _ as it may be hidden in some runtimes)
|
|
26
41
|
(subject_pattern subject: (_ identifier: (_) @type))
|
|
27
42
|
(subject_pattern subject: (_ labels: (labels (symbol) @type)))
|
|
43
|
+
(subject_pattern subject: (_ labels: (labels (quoted_name) @type)))
|
|
28
44
|
(node_pattern subject: (_ identifier: (_) @type))
|
|
29
45
|
(node_pattern subject: (_ labels: (labels (symbol) @type)))
|
|
46
|
+
(node_pattern subject: (_ labels: (labels (quoted_name) @type)))
|
|
30
47
|
(relationship_pattern left: (node_pattern subject: (_ identifier: (_) @type)))
|
|
31
48
|
(relationship_pattern left: (node_pattern subject: (_ labels: (labels (symbol) @type))))
|
|
49
|
+
(relationship_pattern left: (node_pattern subject: (_ labels: (labels (quoted_name) @type))))
|
|
32
50
|
(relationship_pattern right: (node_pattern subject: (_ identifier: (_) @type)))
|
|
33
51
|
(relationship_pattern right: (node_pattern subject: (_ labels: (labels (symbol) @type))))
|
|
52
|
+
(relationship_pattern right: (node_pattern subject: (_ labels: (labels (quoted_name) @type))))
|
|
34
53
|
; Arrow kind: subject is inside optional brackets on the arrow
|
|
35
54
|
(relationship_pattern kind: (right_arrow subject: (_ identifier: (_) @type)))
|
|
36
55
|
(relationship_pattern kind: (right_arrow subject: (_ labels: (labels (symbol) @type))))
|
|
56
|
+
(relationship_pattern kind: (right_arrow subject: (_ labels: (labels (quoted_name) @type))))
|
|
37
57
|
(relationship_pattern kind: (left_arrow subject: (_ identifier: (_) @type)))
|
|
38
58
|
(relationship_pattern kind: (left_arrow subject: (_ labels: (labels (symbol) @type))))
|
|
59
|
+
(relationship_pattern kind: (left_arrow subject: (_ labels: (labels (quoted_name) @type))))
|
|
39
60
|
(relationship_pattern kind: (undirected_arrow subject: (_ identifier: (_) @type)))
|
|
40
61
|
(relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (symbol) @type))))
|
|
62
|
+
(relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (quoted_name) @type))))
|
|
41
63
|
(relationship_pattern kind: (bidirectional_arrow subject: (_ identifier: (_) @type)))
|
|
42
64
|
(relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (symbol) @type))))
|
|
43
|
-
(
|
|
44
|
-
(identified_annotation labels: (labels (symbol) @type))
|
|
45
|
-
|
|
46
|
-
; Symbols and identifiers (generic; definition/reference/tag captured above)
|
|
47
|
-
(symbol) @variable
|
|
65
|
+
(relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (quoted_name) @type))))
|
|
48
66
|
|
|
49
67
|
; Keywords and operators
|
|
50
68
|
[
|
|
@@ -71,11 +89,11 @@
|
|
|
71
89
|
|
|
72
90
|
; Field names in records and maps
|
|
73
91
|
(record_property key: (symbol) @property)
|
|
74
|
-
(record_property key: (
|
|
75
|
-
(record_property key: (
|
|
92
|
+
(record_property key: (quoted_name) @property)
|
|
93
|
+
(record_property key: (double_quoted_name) @property)
|
|
76
94
|
(map_entry key: (symbol) @property)
|
|
77
|
-
(map_entry key: (
|
|
78
|
-
(map_entry key: (
|
|
95
|
+
(map_entry key: (quoted_name) @property)
|
|
96
|
+
(map_entry key: (double_quoted_name) @property)
|
|
79
97
|
|
|
80
98
|
; Annotation keys (property-style) and headers (identified/label-style)
|
|
81
99
|
(property_annotation key: (symbol) @attribute)
|
|
@@ -7,22 +7,31 @@
|
|
|
7
7
|
; Definitions: identifiers that define a pattern or annotation
|
|
8
8
|
(subject_pattern subject: (_ identifier: (_) @local.definition))
|
|
9
9
|
(subject_pattern subject: (_ labels: (labels (symbol) @local.definition)))
|
|
10
|
+
(subject_pattern subject: (_ labels: (labels (quoted_name) @local.definition)))
|
|
10
11
|
(node_pattern subject: (_ identifier: (_) @local.definition))
|
|
11
12
|
(node_pattern subject: (_ labels: (labels (symbol) @local.definition)))
|
|
13
|
+
(node_pattern subject: (_ labels: (labels (quoted_name) @local.definition)))
|
|
12
14
|
(relationship_pattern left: (node_pattern subject: (_ identifier: (_) @local.definition)))
|
|
13
15
|
(relationship_pattern left: (node_pattern subject: (_ labels: (labels (symbol) @local.definition))))
|
|
16
|
+
(relationship_pattern left: (node_pattern subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
14
17
|
(relationship_pattern right: (node_pattern subject: (_ identifier: (_) @local.definition)))
|
|
15
18
|
(relationship_pattern right: (node_pattern subject: (_ labels: (labels (symbol) @local.definition))))
|
|
19
|
+
(relationship_pattern right: (node_pattern subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
16
20
|
(relationship_pattern kind: (right_arrow subject: (_ identifier: (_) @local.definition)))
|
|
17
21
|
(relationship_pattern kind: (right_arrow subject: (_ labels: (labels (symbol) @local.definition))))
|
|
22
|
+
(relationship_pattern kind: (right_arrow subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
18
23
|
(relationship_pattern kind: (left_arrow subject: (_ identifier: (_) @local.definition)))
|
|
19
24
|
(relationship_pattern kind: (left_arrow subject: (_ labels: (labels (symbol) @local.definition))))
|
|
25
|
+
(relationship_pattern kind: (left_arrow subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
20
26
|
(relationship_pattern kind: (undirected_arrow subject: (_ identifier: (_) @local.definition)))
|
|
21
27
|
(relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (symbol) @local.definition))))
|
|
28
|
+
(relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
22
29
|
(relationship_pattern kind: (bidirectional_arrow subject: (_ identifier: (_) @local.definition)))
|
|
23
30
|
(relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (symbol) @local.definition))))
|
|
31
|
+
(relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
24
32
|
(identified_annotation identifier: (_) @local.definition)
|
|
25
33
|
(identified_annotation labels: (labels (symbol) @local.definition))
|
|
34
|
+
(identified_annotation labels: (labels (quoted_name) @local.definition))
|
|
26
35
|
|
|
27
36
|
; References: pattern_reference identifier
|
|
28
37
|
(pattern_reference identifier: (_) @local.reference)
|
package/grammar.js
CHANGED
|
@@ -69,7 +69,7 @@ module.exports = grammar({
|
|
|
69
69
|
|
|
70
70
|
pattern_reference: ($) => field("identifier", $._identifier),
|
|
71
71
|
|
|
72
|
-
_identifier: ($) => choice($.symbol, $.
|
|
72
|
+
_identifier: ($) => choice($.symbol, $.quoted_name, $.integer),
|
|
73
73
|
|
|
74
74
|
_subject: ($) =>
|
|
75
75
|
choice(
|
|
@@ -114,13 +114,13 @@ module.exports = grammar({
|
|
|
114
114
|
|
|
115
115
|
labels: ($) => repeat1($._label),
|
|
116
116
|
|
|
117
|
-
_label: ($) => seq(choice(":", "::"), $.symbol),
|
|
117
|
+
_label: ($) => seq(choice(":", "::"), choice($.symbol, $.quoted_name)),
|
|
118
118
|
|
|
119
119
|
record: ($) => seq("{", commaSep($.record_property), "}"),
|
|
120
120
|
|
|
121
121
|
record_property: ($) =>
|
|
122
122
|
seq(
|
|
123
|
-
field("key", $.
|
|
123
|
+
field("key", $._key_name),
|
|
124
124
|
choice(":", "::"),
|
|
125
125
|
field("value", $._value),
|
|
126
126
|
),
|
|
@@ -128,7 +128,7 @@ module.exports = grammar({
|
|
|
128
128
|
map: ($) => seq("{", commaSep($.map_entry), "}"),
|
|
129
129
|
|
|
130
130
|
map_entry: ($) =>
|
|
131
|
-
seq(field("key", $.
|
|
131
|
+
seq(field("key", $._key_name), ":", field("value", $._scalar_value)),
|
|
132
132
|
|
|
133
133
|
symbol: ($) => token(/[a-zA-Z_][0-9a-zA-Z_.\-@]*/),
|
|
134
134
|
|
|
@@ -174,6 +174,15 @@ module.exports = grammar({
|
|
|
174
174
|
return token(measurement);
|
|
175
175
|
},
|
|
176
176
|
|
|
177
|
+
quoted_name: ($) =>
|
|
178
|
+
delimit_string(alias($._backticked_text, $.string_content), "`"),
|
|
179
|
+
|
|
180
|
+
double_quoted_name: ($) =>
|
|
181
|
+
delimit_string(alias($._double_quoted_text, $.string_content), '"'),
|
|
182
|
+
|
|
183
|
+
_key_name: ($) =>
|
|
184
|
+
choice($.symbol, $.quoted_name, $.double_quoted_name),
|
|
185
|
+
|
|
177
186
|
string_literal: ($) =>
|
|
178
187
|
choice(
|
|
179
188
|
$._single_quoted_string,
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/queries/highlights.scm
CHANGED
|
@@ -21,30 +21,48 @@
|
|
|
21
21
|
; Reference identifier: pattern_reference (FR-001)
|
|
22
22
|
(pattern_reference identifier: (_) @variable)
|
|
23
23
|
|
|
24
|
-
;
|
|
24
|
+
; Symbols and identifiers (generic; definition/reference/tag captured above)
|
|
25
|
+
(symbol) @variable
|
|
26
|
+
|
|
27
|
+
; Definition-like identifiers and labels (FR-001): @type
|
|
28
|
+
; These must come AFTER generic symbol rule to take priority
|
|
29
|
+
|
|
30
|
+
; Labels (symbols and quoted names in labels nodes)
|
|
31
|
+
(labels (symbol) @type)
|
|
32
|
+
(labels (quoted_name) @type)
|
|
33
|
+
|
|
34
|
+
; Annotation identifiers and labels
|
|
35
|
+
(identified_annotation identifier: (_) @type)
|
|
36
|
+
(identified_annotation labels: (labels (symbol) @type))
|
|
37
|
+
(identified_annotation labels: (labels (quoted_name) @type))
|
|
38
|
+
|
|
39
|
+
; Subject, node, and relationship pattern definitions (FR-001): @type
|
|
25
40
|
; subject/node subject is _subject (use wildcard _ as it may be hidden in some runtimes)
|
|
26
41
|
(subject_pattern subject: (_ identifier: (_) @type))
|
|
27
42
|
(subject_pattern subject: (_ labels: (labels (symbol) @type)))
|
|
43
|
+
(subject_pattern subject: (_ labels: (labels (quoted_name) @type)))
|
|
28
44
|
(node_pattern subject: (_ identifier: (_) @type))
|
|
29
45
|
(node_pattern subject: (_ labels: (labels (symbol) @type)))
|
|
46
|
+
(node_pattern subject: (_ labels: (labels (quoted_name) @type)))
|
|
30
47
|
(relationship_pattern left: (node_pattern subject: (_ identifier: (_) @type)))
|
|
31
48
|
(relationship_pattern left: (node_pattern subject: (_ labels: (labels (symbol) @type))))
|
|
49
|
+
(relationship_pattern left: (node_pattern subject: (_ labels: (labels (quoted_name) @type))))
|
|
32
50
|
(relationship_pattern right: (node_pattern subject: (_ identifier: (_) @type)))
|
|
33
51
|
(relationship_pattern right: (node_pattern subject: (_ labels: (labels (symbol) @type))))
|
|
52
|
+
(relationship_pattern right: (node_pattern subject: (_ labels: (labels (quoted_name) @type))))
|
|
34
53
|
; Arrow kind: subject is inside optional brackets on the arrow
|
|
35
54
|
(relationship_pattern kind: (right_arrow subject: (_ identifier: (_) @type)))
|
|
36
55
|
(relationship_pattern kind: (right_arrow subject: (_ labels: (labels (symbol) @type))))
|
|
56
|
+
(relationship_pattern kind: (right_arrow subject: (_ labels: (labels (quoted_name) @type))))
|
|
37
57
|
(relationship_pattern kind: (left_arrow subject: (_ identifier: (_) @type)))
|
|
38
58
|
(relationship_pattern kind: (left_arrow subject: (_ labels: (labels (symbol) @type))))
|
|
59
|
+
(relationship_pattern kind: (left_arrow subject: (_ labels: (labels (quoted_name) @type))))
|
|
39
60
|
(relationship_pattern kind: (undirected_arrow subject: (_ identifier: (_) @type)))
|
|
40
61
|
(relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (symbol) @type))))
|
|
62
|
+
(relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (quoted_name) @type))))
|
|
41
63
|
(relationship_pattern kind: (bidirectional_arrow subject: (_ identifier: (_) @type)))
|
|
42
64
|
(relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (symbol) @type))))
|
|
43
|
-
(
|
|
44
|
-
(identified_annotation labels: (labels (symbol) @type))
|
|
45
|
-
|
|
46
|
-
; Symbols and identifiers (generic; definition/reference/tag captured above)
|
|
47
|
-
(symbol) @variable
|
|
65
|
+
(relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (quoted_name) @type))))
|
|
48
66
|
|
|
49
67
|
; Keywords and operators
|
|
50
68
|
[
|
|
@@ -71,11 +89,11 @@
|
|
|
71
89
|
|
|
72
90
|
; Field names in records and maps
|
|
73
91
|
(record_property key: (symbol) @property)
|
|
74
|
-
(record_property key: (
|
|
75
|
-
(record_property key: (
|
|
92
|
+
(record_property key: (quoted_name) @property)
|
|
93
|
+
(record_property key: (double_quoted_name) @property)
|
|
76
94
|
(map_entry key: (symbol) @property)
|
|
77
|
-
(map_entry key: (
|
|
78
|
-
(map_entry key: (
|
|
95
|
+
(map_entry key: (quoted_name) @property)
|
|
96
|
+
(map_entry key: (double_quoted_name) @property)
|
|
79
97
|
|
|
80
98
|
; Annotation keys (property-style) and headers (identified/label-style)
|
|
81
99
|
(property_annotation key: (symbol) @attribute)
|
package/queries/locals.scm
CHANGED
|
@@ -7,22 +7,31 @@
|
|
|
7
7
|
; Definitions: identifiers that define a pattern or annotation
|
|
8
8
|
(subject_pattern subject: (_ identifier: (_) @local.definition))
|
|
9
9
|
(subject_pattern subject: (_ labels: (labels (symbol) @local.definition)))
|
|
10
|
+
(subject_pattern subject: (_ labels: (labels (quoted_name) @local.definition)))
|
|
10
11
|
(node_pattern subject: (_ identifier: (_) @local.definition))
|
|
11
12
|
(node_pattern subject: (_ labels: (labels (symbol) @local.definition)))
|
|
13
|
+
(node_pattern subject: (_ labels: (labels (quoted_name) @local.definition)))
|
|
12
14
|
(relationship_pattern left: (node_pattern subject: (_ identifier: (_) @local.definition)))
|
|
13
15
|
(relationship_pattern left: (node_pattern subject: (_ labels: (labels (symbol) @local.definition))))
|
|
16
|
+
(relationship_pattern left: (node_pattern subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
14
17
|
(relationship_pattern right: (node_pattern subject: (_ identifier: (_) @local.definition)))
|
|
15
18
|
(relationship_pattern right: (node_pattern subject: (_ labels: (labels (symbol) @local.definition))))
|
|
19
|
+
(relationship_pattern right: (node_pattern subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
16
20
|
(relationship_pattern kind: (right_arrow subject: (_ identifier: (_) @local.definition)))
|
|
17
21
|
(relationship_pattern kind: (right_arrow subject: (_ labels: (labels (symbol) @local.definition))))
|
|
22
|
+
(relationship_pattern kind: (right_arrow subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
18
23
|
(relationship_pattern kind: (left_arrow subject: (_ identifier: (_) @local.definition)))
|
|
19
24
|
(relationship_pattern kind: (left_arrow subject: (_ labels: (labels (symbol) @local.definition))))
|
|
25
|
+
(relationship_pattern kind: (left_arrow subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
20
26
|
(relationship_pattern kind: (undirected_arrow subject: (_ identifier: (_) @local.definition)))
|
|
21
27
|
(relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (symbol) @local.definition))))
|
|
28
|
+
(relationship_pattern kind: (undirected_arrow subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
22
29
|
(relationship_pattern kind: (bidirectional_arrow subject: (_ identifier: (_) @local.definition)))
|
|
23
30
|
(relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (symbol) @local.definition))))
|
|
31
|
+
(relationship_pattern kind: (bidirectional_arrow subject: (_ labels: (labels (quoted_name) @local.definition))))
|
|
24
32
|
(identified_annotation identifier: (_) @local.definition)
|
|
25
33
|
(identified_annotation labels: (labels (symbol) @local.definition))
|
|
34
|
+
(identified_annotation labels: (labels (quoted_name) @local.definition))
|
|
26
35
|
|
|
27
36
|
; References: pattern_reference identifier
|
|
28
37
|
(pattern_reference identifier: (_) @local.reference)
|
package/src/grammar.json
CHANGED
|
@@ -377,7 +377,7 @@
|
|
|
377
377
|
},
|
|
378
378
|
{
|
|
379
379
|
"type": "SYMBOL",
|
|
380
|
-
"name": "
|
|
380
|
+
"name": "quoted_name"
|
|
381
381
|
},
|
|
382
382
|
{
|
|
383
383
|
"type": "SYMBOL",
|
|
@@ -679,8 +679,17 @@
|
|
|
679
679
|
]
|
|
680
680
|
},
|
|
681
681
|
{
|
|
682
|
-
"type": "
|
|
683
|
-
"
|
|
682
|
+
"type": "CHOICE",
|
|
683
|
+
"members": [
|
|
684
|
+
{
|
|
685
|
+
"type": "SYMBOL",
|
|
686
|
+
"name": "symbol"
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
"type": "SYMBOL",
|
|
690
|
+
"name": "quoted_name"
|
|
691
|
+
}
|
|
692
|
+
]
|
|
684
693
|
}
|
|
685
694
|
]
|
|
686
695
|
},
|
|
@@ -738,7 +747,7 @@
|
|
|
738
747
|
"name": "key",
|
|
739
748
|
"content": {
|
|
740
749
|
"type": "SYMBOL",
|
|
741
|
-
"name": "
|
|
750
|
+
"name": "_key_name"
|
|
742
751
|
}
|
|
743
752
|
},
|
|
744
753
|
{
|
|
@@ -818,7 +827,7 @@
|
|
|
818
827
|
"name": "key",
|
|
819
828
|
"content": {
|
|
820
829
|
"type": "SYMBOL",
|
|
821
|
-
"name": "
|
|
830
|
+
"name": "_key_name"
|
|
822
831
|
}
|
|
823
832
|
},
|
|
824
833
|
{
|
|
@@ -979,6 +988,75 @@
|
|
|
979
988
|
"value": "-?(0|[1-9]\\d*)([a-zA-Z]+)"
|
|
980
989
|
}
|
|
981
990
|
},
|
|
991
|
+
"quoted_name": {
|
|
992
|
+
"type": "SEQ",
|
|
993
|
+
"members": [
|
|
994
|
+
{
|
|
995
|
+
"type": "STRING",
|
|
996
|
+
"value": "`"
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
"type": "FIELD",
|
|
1000
|
+
"name": "content",
|
|
1001
|
+
"content": {
|
|
1002
|
+
"type": "ALIAS",
|
|
1003
|
+
"content": {
|
|
1004
|
+
"type": "SYMBOL",
|
|
1005
|
+
"name": "_backticked_text"
|
|
1006
|
+
},
|
|
1007
|
+
"named": true,
|
|
1008
|
+
"value": "string_content"
|
|
1009
|
+
}
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
"type": "STRING",
|
|
1013
|
+
"value": "`"
|
|
1014
|
+
}
|
|
1015
|
+
]
|
|
1016
|
+
},
|
|
1017
|
+
"double_quoted_name": {
|
|
1018
|
+
"type": "SEQ",
|
|
1019
|
+
"members": [
|
|
1020
|
+
{
|
|
1021
|
+
"type": "STRING",
|
|
1022
|
+
"value": "\""
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
"type": "FIELD",
|
|
1026
|
+
"name": "content",
|
|
1027
|
+
"content": {
|
|
1028
|
+
"type": "ALIAS",
|
|
1029
|
+
"content": {
|
|
1030
|
+
"type": "SYMBOL",
|
|
1031
|
+
"name": "_double_quoted_text"
|
|
1032
|
+
},
|
|
1033
|
+
"named": true,
|
|
1034
|
+
"value": "string_content"
|
|
1035
|
+
}
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
"type": "STRING",
|
|
1039
|
+
"value": "\""
|
|
1040
|
+
}
|
|
1041
|
+
]
|
|
1042
|
+
},
|
|
1043
|
+
"_key_name": {
|
|
1044
|
+
"type": "CHOICE",
|
|
1045
|
+
"members": [
|
|
1046
|
+
{
|
|
1047
|
+
"type": "SYMBOL",
|
|
1048
|
+
"name": "symbol"
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
"type": "SYMBOL",
|
|
1052
|
+
"name": "quoted_name"
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
"type": "SYMBOL",
|
|
1056
|
+
"name": "double_quoted_name"
|
|
1057
|
+
}
|
|
1058
|
+
]
|
|
1059
|
+
},
|
|
982
1060
|
"string_literal": {
|
|
983
1061
|
"type": "CHOICE",
|
|
984
1062
|
"members": [
|