tree-sitter-topaz 0.1.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 +171 -0
- package/NOTICE +1 -0
- package/binding.gyp +23 -0
- package/bindings/node/binding.cc +19 -0
- package/bindings/node/index.d.ts +8 -0
- package/bindings/node/index.js +9 -0
- package/grammar.js +1201 -0
- package/package.json +59 -0
- package/queries/highlights.scm +90 -0
- package/queries/indents.scm +24 -0
- package/queries/injections.scm +11 -0
- package/queries/locals.scm +13 -0
- package/src/grammar.json +6462 -0
- package/src/node-types.json +8728 -0
- package/src/parser.c +96271 -0
- package/src/scanner.c +571 -0
- package/src/tree_sitter/alloc.h +54 -0
- package/src/tree_sitter/array.h +291 -0
- package/src/tree_sitter/parser.h +286 -0
- package/tree-sitter.json +36 -0
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tree-sitter-topaz",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"main": "bindings/node",
|
|
6
|
+
"types": "bindings/node",
|
|
7
|
+
"files": [
|
|
8
|
+
"LICENSE",
|
|
9
|
+
"NOTICE",
|
|
10
|
+
"binding.gyp",
|
|
11
|
+
"bindings/node/**",
|
|
12
|
+
"grammar.js",
|
|
13
|
+
"queries/**",
|
|
14
|
+
"src/**",
|
|
15
|
+
"tree-sitter.json"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"install": "node-gyp-build",
|
|
19
|
+
"generate": "tree-sitter generate",
|
|
20
|
+
"test": "tree-sitter test",
|
|
21
|
+
"test:queries": "node scripts/check-queries.mjs",
|
|
22
|
+
"parse:acceptance": "node scripts/parse-acceptance.mjs",
|
|
23
|
+
"prepack": "tree-sitter generate"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"node-addon-api": "^8.5.0",
|
|
27
|
+
"node-gyp-build": "^4.8.4"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"tree-sitter-cli": "^0.25.10"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"tree-sitter": "^0.25.0"
|
|
34
|
+
},
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"tree-sitter": {
|
|
37
|
+
"optional": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"tree-sitter": [
|
|
41
|
+
{
|
|
42
|
+
"scope": "source.topaz",
|
|
43
|
+
"file-types": [
|
|
44
|
+
"tpz"
|
|
45
|
+
],
|
|
46
|
+
"highlights": "queries/highlights.scm",
|
|
47
|
+
"injections": "queries/injections.scm",
|
|
48
|
+
"locals": "queries/locals.scm",
|
|
49
|
+
"indents": "queries/indents.scm"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"directories": {
|
|
53
|
+
"test": "test"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [],
|
|
56
|
+
"author": "",
|
|
57
|
+
"type": "commonjs",
|
|
58
|
+
"description": ""
|
|
59
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
[
|
|
2
|
+
"let"
|
|
3
|
+
"mut"
|
|
4
|
+
"const"
|
|
5
|
+
"type"
|
|
6
|
+
"function"
|
|
7
|
+
"enum"
|
|
8
|
+
"record"
|
|
9
|
+
"newtype"
|
|
10
|
+
"impl"
|
|
11
|
+
"protocol"
|
|
12
|
+
"derives"
|
|
13
|
+
] @keyword
|
|
14
|
+
|
|
15
|
+
[
|
|
16
|
+
"if"
|
|
17
|
+
"else"
|
|
18
|
+
"match"
|
|
19
|
+
"case"
|
|
20
|
+
"for"
|
|
21
|
+
"in"
|
|
22
|
+
"by"
|
|
23
|
+
"while"
|
|
24
|
+
"loop"
|
|
25
|
+
"break"
|
|
26
|
+
"continue"
|
|
27
|
+
"return"
|
|
28
|
+
"defer"
|
|
29
|
+
"using"
|
|
30
|
+
"concurrent"
|
|
31
|
+
] @keyword.control
|
|
32
|
+
|
|
33
|
+
["import" "export" "as"] @keyword.import
|
|
34
|
+
["true" "false" "null"] @constant.builtin
|
|
35
|
+
["int" "float" "string" "bool"] @type.builtin
|
|
36
|
+
["Eq" "Order" "Show" "JSON"] @type.builtin
|
|
37
|
+
|
|
38
|
+
(integer_literal) @number
|
|
39
|
+
(float_literal) @number.float
|
|
40
|
+
(duration_literal) @number
|
|
41
|
+
(string) @string
|
|
42
|
+
(tagged_template) @string.special
|
|
43
|
+
(line_comment) @comment
|
|
44
|
+
(block_comment) @comment
|
|
45
|
+
|
|
46
|
+
(function_declaration name: (identifier) @function)
|
|
47
|
+
(protocol_method_signature name: (identifier) @function.method)
|
|
48
|
+
(call_expression function: (identifier) @function.call)
|
|
49
|
+
(member_expression property: (field_identifier) @property)
|
|
50
|
+
|
|
51
|
+
(type_identifier) @type
|
|
52
|
+
(parameter
|
|
53
|
+
name: (parameter_name (identifier) @variable.parameter))
|
|
54
|
+
(lambda_parameter name: (identifier) @variable.parameter)
|
|
55
|
+
(field_identifier) @property
|
|
56
|
+
(identifier) @variable
|
|
57
|
+
|
|
58
|
+
[
|
|
59
|
+
"+"
|
|
60
|
+
"-"
|
|
61
|
+
"*"
|
|
62
|
+
"/"
|
|
63
|
+
"%"
|
|
64
|
+
"**"
|
|
65
|
+
"=="
|
|
66
|
+
"!="
|
|
67
|
+
"<"
|
|
68
|
+
"<="
|
|
69
|
+
">"
|
|
70
|
+
">="
|
|
71
|
+
"&&"
|
|
72
|
+
"||"
|
|
73
|
+
"??"
|
|
74
|
+
"??="
|
|
75
|
+
"|>"
|
|
76
|
+
">>"
|
|
77
|
+
".."
|
|
78
|
+
"..<"
|
|
79
|
+
"?"
|
|
80
|
+
"="
|
|
81
|
+
"+="
|
|
82
|
+
"-="
|
|
83
|
+
"*="
|
|
84
|
+
"/="
|
|
85
|
+
"%="
|
|
86
|
+
"=>"
|
|
87
|
+
"->"
|
|
88
|
+
] @operator
|
|
89
|
+
|
|
90
|
+
(member_expression operator: (_) @operator)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[
|
|
2
|
+
(block)
|
|
3
|
+
(record_body)
|
|
4
|
+
(enum_body)
|
|
5
|
+
(concurrent_body)
|
|
6
|
+
(record_literal)
|
|
7
|
+
(record_construction)
|
|
8
|
+
(record_update)
|
|
9
|
+
(record_type)
|
|
10
|
+
(record_pattern)
|
|
11
|
+
(nominal_record_pattern)
|
|
12
|
+
(array_literal)
|
|
13
|
+
(set_literal)
|
|
14
|
+
(map_literal)
|
|
15
|
+
(import_list)
|
|
16
|
+
(call_argument_list)
|
|
17
|
+
(parameter_list)
|
|
18
|
+
] @indent
|
|
19
|
+
|
|
20
|
+
[
|
|
21
|
+
"}"
|
|
22
|
+
"]"
|
|
23
|
+
")"
|
|
24
|
+
] @outdent
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
((tagged_template) @injection.content
|
|
2
|
+
(#match? @injection.content "^sql(?:\"|\"\"\")")
|
|
3
|
+
(#set! injection.language "sql"))
|
|
4
|
+
|
|
5
|
+
((tagged_template) @injection.content
|
|
6
|
+
(#match? @injection.content "^sh(?:\"|\"\"\")")
|
|
7
|
+
(#set! injection.language "bash"))
|
|
8
|
+
|
|
9
|
+
((tagged_template) @injection.content
|
|
10
|
+
(#match? @injection.content "^r(?:\"|\"\"\")")
|
|
11
|
+
(#set! injection.language "regex"))
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
(source_file) @local.scope
|
|
2
|
+
(block) @local.scope
|
|
3
|
+
(function_declaration) @local.scope
|
|
4
|
+
(lambda_expression) @local.scope
|
|
5
|
+
|
|
6
|
+
(function_declaration name: (identifier) @local.definition)
|
|
7
|
+
(parameter
|
|
8
|
+
name: (parameter_name (identifier) @local.definition))
|
|
9
|
+
(lambda_parameter name: (identifier) @local.definition)
|
|
10
|
+
(let_declaration pattern: (binding_pattern (identifier) @local.definition))
|
|
11
|
+
(const_declaration name: (identifier) @local.definition)
|
|
12
|
+
|
|
13
|
+
(identifier) @local.reference
|