tree-sitter-bynk 0.55.0
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/binding.gyp +30 -0
- package/bindings/node/binding.cc +20 -0
- package/bindings/node/binding_test.js +9 -0
- package/bindings/node/index.d.ts +28 -0
- package/bindings/node/index.js +11 -0
- package/grammar.js +1062 -0
- package/package.json +62 -0
- package/queries/highlights.scm +176 -0
- package/queries/injections.scm +1 -0
- package/src/grammar.json +5573 -0
- package/src/node-types.json +6801 -0
- package/src/parser.c +48207 -0
- package/src/scanner.c +156 -0
- package/src/tree_sitter/alloc.h +54 -0
- package/src/tree_sitter/array.h +291 -0
- package/src/tree_sitter/parser.h +266 -0
- package/tree-sitter.json +28 -0
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tree-sitter-bynk",
|
|
3
|
+
"version": "0.55.0",
|
|
4
|
+
"description": "Tree-sitter grammar for the Bynk DSL (v0–v0.16).",
|
|
5
|
+
"main": "bindings/node",
|
|
6
|
+
"types": "bindings/node",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"tree-sitter",
|
|
9
|
+
"parser",
|
|
10
|
+
"bynk"
|
|
11
|
+
],
|
|
12
|
+
"author": "Bynk project",
|
|
13
|
+
"license": "MIT OR Apache-2.0",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/accuser/bynk.git",
|
|
17
|
+
"directory": "tree-sitter-bynk"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/accuser/bynk/tree/main/tree-sitter-bynk",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/accuser/bynk/issues"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"install": "node-gyp-build",
|
|
25
|
+
"build": "tree-sitter generate",
|
|
26
|
+
"test": "tree-sitter test"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"node-addon-api": "^8.0.0",
|
|
30
|
+
"node-gyp-build": "^4.8.0"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"tree-sitter": "^0.21.0"
|
|
34
|
+
},
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"tree-sitter": {
|
|
37
|
+
"optional": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"prebuildify": "^6.0.0",
|
|
42
|
+
"tree-sitter-cli": "^0.24.0"
|
|
43
|
+
},
|
|
44
|
+
"tree-sitter": [
|
|
45
|
+
{
|
|
46
|
+
"scope": "source.bynk",
|
|
47
|
+
"file-types": [
|
|
48
|
+
"bynk"
|
|
49
|
+
],
|
|
50
|
+
"highlights": "queries/highlights.scm"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"files": [
|
|
54
|
+
"grammar.js",
|
|
55
|
+
"tree-sitter.json",
|
|
56
|
+
"binding.gyp",
|
|
57
|
+
"prebuilds/**",
|
|
58
|
+
"bindings/node/*",
|
|
59
|
+
"queries/*",
|
|
60
|
+
"src/**"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
; Bynk highlighting queries.
|
|
2
|
+
;
|
|
3
|
+
; Maps grammar nodes to standard tree-sitter highlighting groups. See
|
|
4
|
+
; design/bynk-tree-sitter-spec.md §2 for the group inventory.
|
|
5
|
+
|
|
6
|
+
; -- Keywords --
|
|
7
|
+
|
|
8
|
+
[
|
|
9
|
+
"if"
|
|
10
|
+
"else"
|
|
11
|
+
"let"
|
|
12
|
+
"match"
|
|
13
|
+
"is"
|
|
14
|
+
"commit"
|
|
15
|
+
"assert"
|
|
16
|
+
"on"
|
|
17
|
+
"given"
|
|
18
|
+
"call"
|
|
19
|
+
"from"
|
|
20
|
+
"http"
|
|
21
|
+
"cron"
|
|
22
|
+
"queue"
|
|
23
|
+
"schedule"
|
|
24
|
+
"message"
|
|
25
|
+
] @keyword
|
|
26
|
+
|
|
27
|
+
[
|
|
28
|
+
"uses"
|
|
29
|
+
"consumes"
|
|
30
|
+
"as"
|
|
31
|
+
] @keyword.import
|
|
32
|
+
|
|
33
|
+
[
|
|
34
|
+
"commons"
|
|
35
|
+
"context"
|
|
36
|
+
"type"
|
|
37
|
+
"fn"
|
|
38
|
+
"capability"
|
|
39
|
+
"provides"
|
|
40
|
+
"service"
|
|
41
|
+
"agent"
|
|
42
|
+
"state"
|
|
43
|
+
"exports"
|
|
44
|
+
"key"
|
|
45
|
+
"test"
|
|
46
|
+
"mocks"
|
|
47
|
+
"integration"
|
|
48
|
+
"wires"
|
|
49
|
+
] @keyword.declaration
|
|
50
|
+
|
|
51
|
+
[
|
|
52
|
+
"opaque"
|
|
53
|
+
"transparent"
|
|
54
|
+
] @keyword.modifier
|
|
55
|
+
|
|
56
|
+
[
|
|
57
|
+
"where"
|
|
58
|
+
"and"
|
|
59
|
+
"enum"
|
|
60
|
+
] @keyword.operator
|
|
61
|
+
|
|
62
|
+
; HTTP method on `on http METHOD "path"` handlers.
|
|
63
|
+
(http_method) @keyword
|
|
64
|
+
|
|
65
|
+
; -- Types --
|
|
66
|
+
|
|
67
|
+
(base_type) @type.builtin
|
|
68
|
+
(validation_error_type) @type.builtin
|
|
69
|
+
|
|
70
|
+
(builtin_type) @type.builtin
|
|
71
|
+
|
|
72
|
+
; User-defined type names appear in type positions.
|
|
73
|
+
(type_decl name: (identifier) @type)
|
|
74
|
+
(opaque_type) @type
|
|
75
|
+
(generic_type_ref arg: (identifier) @type)
|
|
76
|
+
(record_field type: (identifier) @type)
|
|
77
|
+
(variant_payload_field type: (identifier) @type)
|
|
78
|
+
(param type: (identifier) @type)
|
|
79
|
+
(method_name type: (identifier) @type)
|
|
80
|
+
(record_construction type: (identifier) @type)
|
|
81
|
+
(record_spread type: (identifier) @type)
|
|
82
|
+
(variant_pattern type: (identifier) @type)
|
|
83
|
+
(key_decl type: (identifier) @type)
|
|
84
|
+
|
|
85
|
+
; -- Functions --
|
|
86
|
+
|
|
87
|
+
(fn_decl name: (identifier) @function)
|
|
88
|
+
(fn_decl name: (method_name method: (identifier) @function.method))
|
|
89
|
+
(call name: (identifier) @function)
|
|
90
|
+
(method_call method: (identifier) @function.method)
|
|
91
|
+
(capability_op name: (identifier) @function.method)
|
|
92
|
+
(provider_op name: (identifier) @function.method)
|
|
93
|
+
(call_handler method: (identifier) @function.method)
|
|
94
|
+
|
|
95
|
+
["Ok" "Err" "Some"] @function.builtin
|
|
96
|
+
(none_expr) @constant.builtin
|
|
97
|
+
(effect_pure_expr "Effect" @type.builtin
|
|
98
|
+
"pure" @function.builtin)
|
|
99
|
+
(mock_expr "Mock" @function.builtin)
|
|
100
|
+
|
|
101
|
+
; -- Variables / parameters --
|
|
102
|
+
|
|
103
|
+
(param name: (identifier) @variable.parameter)
|
|
104
|
+
(let_stmt name: (identifier) @variable)
|
|
105
|
+
(effect_let_stmt name: (identifier) @variable)
|
|
106
|
+
(self_expr) @variable.builtin
|
|
107
|
+
(self_param) @variable.builtin
|
|
108
|
+
(key_decl name: (identifier) @variable.parameter)
|
|
109
|
+
|
|
110
|
+
; -- Fields --
|
|
111
|
+
|
|
112
|
+
(record_field name: (identifier) @field)
|
|
113
|
+
(variant_payload_field name: (identifier) @field)
|
|
114
|
+
(field_access field: (identifier) @field)
|
|
115
|
+
(field_init name: (identifier) @field)
|
|
116
|
+
(field_init shorthand: (identifier) @field)
|
|
117
|
+
(named_binding field: (identifier) @field)
|
|
118
|
+
(positional_binding (identifier) @variable)
|
|
119
|
+
|
|
120
|
+
; -- Variants & constants --
|
|
121
|
+
|
|
122
|
+
; Sum/enum variant declarations keep the dedicated `constant_name` node.
|
|
123
|
+
(constant_name) @constant
|
|
124
|
+
; Variant names in patterns are plain identifiers; treat a capitalised
|
|
125
|
+
; pattern variant as a constant.
|
|
126
|
+
((variant_pattern variant: (identifier) @constant)
|
|
127
|
+
(#match? @constant "^[A-Z]"))
|
|
128
|
+
(boolean_literal) @constant.builtin
|
|
129
|
+
|
|
130
|
+
; -- Literals --
|
|
131
|
+
|
|
132
|
+
(string_literal) @string
|
|
133
|
+
(number_literal) @number
|
|
134
|
+
(float_literal) @number
|
|
135
|
+
(unit_literal) @constant.builtin
|
|
136
|
+
|
|
137
|
+
; -- Refinement predicates --
|
|
138
|
+
|
|
139
|
+
(predicate_name) @attribute
|
|
140
|
+
|
|
141
|
+
; -- Module references --
|
|
142
|
+
|
|
143
|
+
(qualified_name (identifier) @module)
|
|
144
|
+
(uses_decl target: (qualified_name) @module)
|
|
145
|
+
(consumes_decl target: (qualified_name) @module)
|
|
146
|
+
(test_decl target: (qualified_name) @module)
|
|
147
|
+
|
|
148
|
+
; -- Operators & punctuation --
|
|
149
|
+
|
|
150
|
+
[
|
|
151
|
+
"+" "-" "*" "/"
|
|
152
|
+
"==" "!=" "<" "<=" ">" ">="
|
|
153
|
+
"&&" "||" "!"
|
|
154
|
+
"<-" "->" "=" "?"
|
|
155
|
+
] @operator
|
|
156
|
+
|
|
157
|
+
[
|
|
158
|
+
"(" ")" "{" "}" "[" "]"
|
|
159
|
+
] @punctuation.bracket
|
|
160
|
+
|
|
161
|
+
[
|
|
162
|
+
"," ":" "|"
|
|
163
|
+
] @punctuation.delimiter
|
|
164
|
+
|
|
165
|
+
[
|
|
166
|
+
"=>" "..."
|
|
167
|
+
] @punctuation.special
|
|
168
|
+
|
|
169
|
+
; -- Comments --
|
|
170
|
+
|
|
171
|
+
(line_comment) @comment
|
|
172
|
+
(doc_block) @comment.documentation
|
|
173
|
+
|
|
174
|
+
; -- Errors (tree-sitter recovery) --
|
|
175
|
+
|
|
176
|
+
(ERROR) @error
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
; No language injections currently; doc-block contents are plain text.
|