tree-sitter-compact 0.0.0-stage → 0.2.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/LICENSE +201 -0
- package/NOTICE +15 -0
- package/README.md +95 -2
- package/binding.gyp +35 -0
- package/bindings/node/binding.cc +19 -0
- package/bindings/node/index.d.ts +27 -0
- package/bindings/node/index.js +11 -0
- package/grammar.js +847 -0
- package/package.json +69 -4
- package/prebuilds/darwin-arm64/tree-sitter-compact.node +0 -0
- package/prebuilds/darwin-x64/tree-sitter-compact.node +0 -0
- package/prebuilds/linux-arm64/tree-sitter-compact.node +0 -0
- package/prebuilds/linux-x64/tree-sitter-compact.node +0 -0
- package/prebuilds/win32-x64/tree-sitter-compact.node +0 -0
- package/queries/highlights.scm +130 -0
- package/src/grammar.json +4551 -0
- package/src/node-types.json +3318 -0
- package/src/parser.c +38111 -0
- package/src/tree_sitter/alloc.h +54 -0
- package/src/tree_sitter/array.h +336 -0
- package/src/tree_sitter/parser.h +286 -0
- package/tree-sitter-compact.wasm +0 -0
- package/tree-sitter.json +46 -0
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tree-sitter-compact",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "A zero-knowledge smart contract programming language",
|
|
5
|
+
"repository": "https://github.com/1NickPappas/compact-tree-sitter",
|
|
6
|
+
"homepage": "https://github.com/1NickPappas/compact-tree-sitter#readme",
|
|
7
|
+
"bugs": "https://github.com/1NickPappas/compact-tree-sitter/issues",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"author": {
|
|
10
|
+
"name": "Nick Pappas",
|
|
11
|
+
"url": "https://github.com/1NickPappas"
|
|
12
|
+
},
|
|
13
|
+
"contributors": [
|
|
14
|
+
{
|
|
15
|
+
"name": "Lucas Rosa",
|
|
16
|
+
"email": "lucas.rosa@shielded.io"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"compact": {
|
|
20
|
+
"language": "0.23.0",
|
|
21
|
+
"toolchain": "0.31.1",
|
|
22
|
+
"runtime": "0.16.0"
|
|
23
|
+
},
|
|
24
|
+
"main": "bindings/node",
|
|
25
|
+
"types": "bindings/node",
|
|
26
|
+
"keywords": [
|
|
27
|
+
"incremental",
|
|
28
|
+
"parsing",
|
|
29
|
+
"tree-sitter",
|
|
30
|
+
"compact"
|
|
31
|
+
],
|
|
32
|
+
"files": [
|
|
33
|
+
"grammar.js",
|
|
34
|
+
"tree-sitter.json",
|
|
35
|
+
"binding.gyp",
|
|
36
|
+
"prebuilds/**",
|
|
37
|
+
"bindings/node/*",
|
|
38
|
+
"queries/*",
|
|
39
|
+
"src/**",
|
|
40
|
+
"*.wasm",
|
|
41
|
+
"LICENSE",
|
|
42
|
+
"NOTICE"
|
|
43
|
+
],
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"node-addon-api": "^8.5.0",
|
|
46
|
+
"node-gyp-build": "^4.8.4"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"eslint": "^9.35.0",
|
|
50
|
+
"eslint-config-treesitter": "^1.0.2",
|
|
51
|
+
"prebuildify": "^6.0.1",
|
|
52
|
+
"tree-sitter-cli": "^0.26.7"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"tree-sitter": "^0.25.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"tree-sitter": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"install": "node-gyp-build",
|
|
64
|
+
"lint": "eslint grammar.js",
|
|
65
|
+
"prestart": "tree-sitter build --wasm",
|
|
66
|
+
"start": "tree-sitter playground",
|
|
67
|
+
"test": "tree-sitter test",
|
|
68
|
+
"generate": "tree-sitter generate",
|
|
69
|
+
"parse": "tree-sitter parse"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
; This file is part of compact-tree-sitter.
|
|
2
|
+
; Copyright (C) 2025 Midnight Foundation
|
|
3
|
+
; Modifications Copyright (C) 2025 Nick Pappas and compact-tree-sitter contributors
|
|
4
|
+
; SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
; Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
; you may not use this file except in compliance with the License.
|
|
7
|
+
; You may obtain a copy of the License at
|
|
8
|
+
;
|
|
9
|
+
; http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
;
|
|
11
|
+
; Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
; distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
; See the License for the specific language governing permissions and
|
|
15
|
+
; limitations under the License.
|
|
16
|
+
|
|
17
|
+
; Comments
|
|
18
|
+
(comment) @comment
|
|
19
|
+
|
|
20
|
+
; Keywords
|
|
21
|
+
"pragma" @keyword
|
|
22
|
+
"import" @keyword
|
|
23
|
+
"export" @keyword
|
|
24
|
+
"module" @keyword
|
|
25
|
+
"include" @keyword
|
|
26
|
+
"ledger" @keyword
|
|
27
|
+
"circuit" @keyword
|
|
28
|
+
"witness" @keyword
|
|
29
|
+
"contract" @keyword
|
|
30
|
+
"struct" @keyword
|
|
31
|
+
"enum" @keyword
|
|
32
|
+
"type" @keyword
|
|
33
|
+
"new" @keyword
|
|
34
|
+
"constructor" @keyword.function
|
|
35
|
+
(pure) @keyword.modifier
|
|
36
|
+
(sealed) @keyword.modifier
|
|
37
|
+
"prefix" @keyword.modifier
|
|
38
|
+
"from" @keyword.modifier
|
|
39
|
+
"return" @keyword.return
|
|
40
|
+
"if" @keyword.conditional
|
|
41
|
+
"else" @keyword.conditional
|
|
42
|
+
"for" @keyword.repeat
|
|
43
|
+
"of" @keyword.repeat
|
|
44
|
+
"assert" @keyword
|
|
45
|
+
"const" @keyword
|
|
46
|
+
"default" @keyword
|
|
47
|
+
"map" @keyword
|
|
48
|
+
"fold" @keyword
|
|
49
|
+
"slice" @keyword
|
|
50
|
+
"disclose" @keyword
|
|
51
|
+
"pad" @keyword
|
|
52
|
+
|
|
53
|
+
; Operators
|
|
54
|
+
"=" @operator
|
|
55
|
+
"+=" @operator
|
|
56
|
+
"-=" @operator
|
|
57
|
+
(equals) @operator
|
|
58
|
+
(not_equals) @operator
|
|
59
|
+
(greater_than) @operator
|
|
60
|
+
(less_than) @operator
|
|
61
|
+
(greater_than_or_equal) @operator
|
|
62
|
+
(less_than_or_equal) @operator
|
|
63
|
+
(not) @operator
|
|
64
|
+
(and) @operator
|
|
65
|
+
(or) @operator
|
|
66
|
+
"+" @operator
|
|
67
|
+
"-" @operator
|
|
68
|
+
"*" @operator
|
|
69
|
+
":" @operator
|
|
70
|
+
"." @operator
|
|
71
|
+
"as" @operator
|
|
72
|
+
"=>" @operator
|
|
73
|
+
"?" @operator
|
|
74
|
+
".." @operator
|
|
75
|
+
"..." @operator
|
|
76
|
+
|
|
77
|
+
; Identifiers
|
|
78
|
+
(id) @variable
|
|
79
|
+
(module_name) @module
|
|
80
|
+
(function_name) @function
|
|
81
|
+
(struct_name) @type
|
|
82
|
+
(enum_name) @type
|
|
83
|
+
(type_name) @type
|
|
84
|
+
(contract_name) @type
|
|
85
|
+
(tvar_name) @type.parameter
|
|
86
|
+
|
|
87
|
+
; Types
|
|
88
|
+
(tref (id) @type)
|
|
89
|
+
"Boolean" @type.builtin
|
|
90
|
+
"Field" @type.builtin
|
|
91
|
+
"Uint" @type.builtin
|
|
92
|
+
"Bytes" @type.builtin
|
|
93
|
+
"Opaque" @type.builtin
|
|
94
|
+
"Vector" @type.builtin
|
|
95
|
+
|
|
96
|
+
; Literals
|
|
97
|
+
(nat) @number
|
|
98
|
+
(str) @string
|
|
99
|
+
(file) @string
|
|
100
|
+
(version) @constant
|
|
101
|
+
"true" @boolean
|
|
102
|
+
"false" @boolean
|
|
103
|
+
|
|
104
|
+
; Punctuation
|
|
105
|
+
";" @punctuation.delimiter
|
|
106
|
+
"," @punctuation.delimiter
|
|
107
|
+
"(" @punctuation.bracket
|
|
108
|
+
")" @punctuation.bracket
|
|
109
|
+
"[" @punctuation.bracket
|
|
110
|
+
"]" @punctuation.bracket
|
|
111
|
+
"{" @punctuation.bracket
|
|
112
|
+
"}" @punctuation.bracket
|
|
113
|
+
"<" @punctuation.bracket
|
|
114
|
+
">" @punctuation.bracket
|
|
115
|
+
|
|
116
|
+
; Declarations
|
|
117
|
+
(pragma (id) @property)
|
|
118
|
+
(import_name (id) @namespace)
|
|
119
|
+
(import_element (id) @namespace)
|
|
120
|
+
(import_element alias: (id) @namespace)
|
|
121
|
+
(gargs (_) @type.parameter)
|
|
122
|
+
(struct_named_field_initializer (id) @field)
|
|
123
|
+
(pattern_struct_elt (id) @field)
|
|
124
|
+
|
|
125
|
+
; Function definitions and calls
|
|
126
|
+
(cdefn (function_name) @function)
|
|
127
|
+
(wdecl (function_name) @function)
|
|
128
|
+
(ecdecl_circuit (id) @function)
|
|
129
|
+
(fun (id) @function)
|
|
130
|
+
(member_access_expr member: (id) @function.method)
|