@willbooster/tree-sitter-go 6.2.0 → 7.0.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/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Test](https://github.com/WillBooster/tree-sitter-go/actions/workflows/test.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-go/actions/workflows/test.yml)
6
6
  [![Test rust](https://github.com/WillBooster/tree-sitter-go/actions/workflows/test-rust.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-go/actions/workflows/test-rust.yml)
7
7
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
8
- [![wbfy](https://img.shields.io/badge/wbfy-20.48.9-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
8
+ [![wbfy](https://img.shields.io/badge/wbfy-20.51.1-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
9
9
  [![crates.io](https://img.shields.io/crates/v/willbooster-tree-sitter-go.svg)](https://crates.io/crates/willbooster-tree-sitter-go)
10
10
 
11
11
  Go grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
@@ -17,6 +17,13 @@ This fork extends upstream's version 0.25.0 grammar with method type parameters
17
17
  number (`0x5742000b`), so it loads only with the WillBooster runtime, version 15.0.0 or later within 15.x
18
18
  (`willbooster-tree-sitter`, `@willbooster/web-tree-sitter`), and not with upstream's tree-sitter.
19
19
 
20
+ ## Support Scope
21
+
22
+ This fork maintains only full parsing: valid input yields a correct tree, and invalid input yields `ERROR` or `MISSING`
23
+ nodes without crashing, hanging, or taking more than linear time. Incremental parsing works as in upstream tree-sitter
24
+ but is not tested here, and no queries (highlights, locals, injections, tags) are shipped. Node types, field names, and
25
+ the trees that error recovery produces may change; such changes are released as new major versions.
26
+
20
27
  ## Usage
21
28
 
22
29
  The npm package ships `tree-sitter-go.wasm` for
@@ -59,7 +66,7 @@ const parser = new Parser();
59
66
  parser.setLanguage(await Language.load(go));
60
67
  ```
61
68
 
62
- The package also ships `grammar.js`, the queries in `queries/`, and the node types in `src/node-types.json`.
69
+ The package also ships `grammar.js` and the node types in `src/node-types.json`.
63
70
 
64
71
  In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-go) and on
65
72
  [willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
@@ -68,7 +75,7 @@ fuzzed with:
68
75
  ```toml
69
76
  [dependencies]
70
77
  tree-sitter = { package = "willbooster-tree-sitter", version = "15.0.0" }
71
- tree-sitter-go = { package = "willbooster-tree-sitter-go", version = "6" }
78
+ tree-sitter-go = { package = "willbooster-tree-sitter-go", version = "7" }
72
79
  ```
73
80
 
74
81
  ```rust
@@ -104,9 +111,6 @@ and the release build regenerate the parsers before compiling them.
104
111
  `bun run test` runs:
105
112
 
106
113
  - the corpus in `test/corpus`, with the native build and with the Wasm build (the first run downloads the WASI SDK);
107
- - an incremental-parsing check (`test/unit/incremental.test.ts`): `script/fuzz-corpus` runs `tree-sitter fuzz`, which
108
- edits each corpus case at random, reparses it, undoes the edits, and reparses again. `TREE_SITTER_SEED`,
109
- `TREE_SITTER_ITERATIONS`, and `TREE_SITTER_EDITS` run other or more edits;
110
114
  - a check that the real-world Go files in `examples/`, the checked-in ones and those of the cloned repositories, fail to
111
115
  parse exactly as listed in `script/known-failures.txt`. Many of the listed files are test data that is invalid Go on
112
116
  purpose. The first run clones the repositories. The example repositories are pinned to commits in
@@ -122,8 +126,7 @@ and the release build regenerate the parsers before compiling them.
122
126
  Cloudflare Workers with and without Node.js compatibility (`test/e2e/workers.test.ts`).
123
127
 
124
128
  The tests and `script/parse-examples` compile the parser into `.tmp/tree-sitter-lib` rather than the CLI's cache shared
125
- by every checkout; `script/fuzz-corpus` builds a parser of its own in `.tmp/fuzz` for each run and deletes it
126
- afterwards.
129
+ by every checkout.
127
130
 
128
131
  CI also runs these tests on Linux arm64 and macOS, where the CLI compiles the parser natively, and fuzzes the parser
129
132
  with libFuzzer and sanitizers (`.github/workflows/robustness.yml`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-go",
3
- "version": "6.2.0",
3
+ "version": "7.0.0",
4
4
  "description": "Go grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "go",
@@ -16,7 +16,6 @@
16
16
  },
17
17
  "files": [
18
18
  "grammar.js",
19
- "queries/*.scm",
20
19
  "src/node-types.json",
21
20
  "tree-sitter.json",
22
21
  "*.wasm"
@@ -46,15 +45,15 @@
46
45
  },
47
46
  "devDependencies": {
48
47
  "@tsconfig/bun": "1.0.11",
49
- "@types/bun": "1.4.3",
48
+ "@types/bun": "1.4.4",
50
49
  "@vitest/browser-playwright": "5.0.5",
51
50
  "@willbooster/oxlint-config": "1.4.9",
52
- "@willbooster/wb": "22.29.3",
53
- "@willbooster/web-tree-sitter": "15.0.0",
51
+ "@willbooster/wb": "22.32.3",
52
+ "@willbooster/web-tree-sitter": "15.5.4",
54
53
  "conventional-changelog-conventionalcommits": "10.4.1",
55
54
  "lefthook": "2.2.2",
56
- "oxlint": "1.88.0",
57
- "oxlint-tsgolint": "7.0.2004",
55
+ "oxlint": "1.89.0",
56
+ "oxlint-tsgolint": "7.0.2005",
58
57
  "playwright": "1.64.1",
59
58
  "semantic-release": "25.0.9",
60
59
  "vitest": "5.0.5",
Binary file
package/tree-sitter.json CHANGED
@@ -8,13 +8,11 @@
8
8
  "path": ".",
9
9
  "file-types": [
10
10
  "go"
11
- ],
12
- "highlights": "queries/highlights.scm",
13
- "tags": "queries/tags.scm"
11
+ ]
14
12
  }
15
13
  ],
16
14
  "metadata": {
17
- "version": "6.2.0",
15
+ "version": "7.0.0",
18
16
  "license": "MIT",
19
17
  "description": "Go grammar for tree-sitter",
20
18
  "authors": [
@@ -1,168 +0,0 @@
1
- (type_identifier) @type
2
- (field_identifier) @property
3
- (tag_name) @attribute
4
- (identifier) @variable
5
-
6
- (call_expression
7
- function: (identifier) @function)
8
-
9
- (call_expression
10
- function: (identifier) @function.builtin
11
- (#match? @function.builtin "^(append|cap|clear|close|complex|copy|delete|imag|len|make|max|min|new|panic|print|println|real|recover)$"))
12
-
13
- (call_expression
14
- function: (selector_expression
15
- field: (field_identifier) @function.method))
16
-
17
- (function_declaration
18
- name: (identifier) @function)
19
-
20
- (method_declaration
21
- name: (field_identifier) @function.method)
22
-
23
- [
24
- "--"
25
- "-"
26
- "-="
27
- ":="
28
- "!"
29
- "!="
30
- "..."
31
- "*"
32
- "*"
33
- "*="
34
- "/"
35
- "/="
36
- "&"
37
- "&&"
38
- "&="
39
- "%"
40
- "%="
41
- "^"
42
- "^="
43
- "+"
44
- "++"
45
- "+="
46
- "<-"
47
- "<"
48
- "<<"
49
- "<<="
50
- "<="
51
- "="
52
- "=="
53
- ">"
54
- ">="
55
- ">>"
56
- ">>="
57
- "|"
58
- "|="
59
- "||"
60
- "~"
61
- ] @operator
62
-
63
- [
64
- "break"
65
- "case"
66
- "chan"
67
- "const"
68
- "continue"
69
- "default"
70
- "defer"
71
- "else"
72
- "fallthrough"
73
- "for"
74
- "func"
75
- "go"
76
- "goto"
77
- "if"
78
- "import"
79
- "interface"
80
- "map"
81
- "package"
82
- "range"
83
- "return"
84
- "select"
85
- "struct"
86
- "switch"
87
- "type"
88
- "var"
89
- ] @keyword
90
-
91
- [
92
- (interpreted_string_literal)
93
- (raw_string_literal)
94
- (rune_literal)
95
- ] @string
96
-
97
- ((call_expression
98
- function: (identifier) @function
99
- arguments: (argument_list
100
- . (comment)*
101
- . [
102
- (interpreted_string_literal
103
- . [(interpreted_string_literal_content) (escape_sequence) (format_specifier) @string.special]* .)
104
- (raw_string_literal
105
- . [(raw_string_literal_content) (format_specifier) @string.special]* .)
106
- ]))
107
- (#match? @function "^(Printf|Sprintf|Errorf|Scanf|Fatalf|Panicf|Skipf|Logf|Debugf|Infof|Warnf|Warningf|Tracef)$"))
108
-
109
- ((call_expression
110
- function: (selector_expression field: (field_identifier) @function.method)
111
- arguments: (argument_list
112
- . (comment)*
113
- . [
114
- (interpreted_string_literal
115
- . [(interpreted_string_literal_content) (escape_sequence) (format_specifier) @string.special]* .)
116
- (raw_string_literal
117
- . [(raw_string_literal_content) (format_specifier) @string.special]* .)
118
- ]))
119
- (#match? @function.method "^(Printf|Sprintf|Errorf|Scanf|Fatalf|Panicf|Skipf|Logf|Debugf|Infof|Warnf|Warningf|Tracef)$"))
120
-
121
- ((call_expression
122
- function: (identifier) @function
123
- arguments: (argument_list
124
- . (comment)*
125
- . (_)
126
- . (comment)*
127
- . ","
128
- . (comment)*
129
- . [
130
- (interpreted_string_literal
131
- . [(interpreted_string_literal_content) (escape_sequence) (format_specifier) @string.special]* .)
132
- (raw_string_literal
133
- . [(raw_string_literal_content) (format_specifier) @string.special]* .)
134
- ]))
135
- (#match? @function "^(Fprintf|Appendf|Fscanf|Sscanf)$"))
136
-
137
- ((call_expression
138
- function: (selector_expression field: (field_identifier) @function.method)
139
- arguments: (argument_list
140
- . (comment)*
141
- . (_)
142
- . (comment)*
143
- . ","
144
- . (comment)*
145
- . [
146
- (interpreted_string_literal
147
- . [(interpreted_string_literal_content) (escape_sequence) (format_specifier) @string.special]* .)
148
- (raw_string_literal
149
- . [(raw_string_literal_content) (format_specifier) @string.special]* .)
150
- ]))
151
- (#match? @function.method "^(Fprintf|Appendf|Fscanf|Sscanf)$"))
152
-
153
- (escape_sequence) @escape
154
-
155
- [
156
- (int_literal)
157
- (float_literal)
158
- (imaginary_literal)
159
- ] @number
160
-
161
- [
162
- (true)
163
- (false)
164
- (nil)
165
- (iota)
166
- ] @constant.builtin
167
-
168
- (comment) @comment
package/queries/tags.scm DELETED
@@ -1,70 +0,0 @@
1
- (
2
- (comment)* @doc
3
- .
4
- (function_declaration
5
- name: (identifier) @name) @definition.function
6
- (#strip! @doc "^//\\s*")
7
- (#select-adjacent! @doc @definition.function)
8
- )
9
-
10
- (
11
- (comment)* @doc
12
- .
13
- (method_declaration
14
- name: (field_identifier) @name) @definition.method
15
- (#strip! @doc "^//\\s*")
16
- (#select-adjacent! @doc @definition.method)
17
- )
18
-
19
- (call_expression
20
- function: [
21
- (identifier) @name
22
- (parenthesized_expression (identifier) @name)
23
- (selector_expression field: (field_identifier) @name)
24
- (parenthesized_expression (selector_expression field: (field_identifier) @name))
25
- ]) @reference.call
26
-
27
- (
28
- (type_spec
29
- name: (type_identifier) @name) @definition.type
30
- (#not-eq? @name "_")
31
- )
32
-
33
- (
34
- (type_alias
35
- name: (type_identifier) @name) @definition.type
36
- (#not-eq? @name "_")
37
- )
38
-
39
- (type_identifier) @name @reference.type
40
-
41
- (package_clause "package" (package_identifier) @name)
42
-
43
- (method_elem
44
- name: (field_identifier) @name) @definition.method
45
-
46
- (
47
- (field_declaration
48
- name: (field_identifier) @name) @definition.field
49
- (#not-eq? @name "_")
50
- )
51
-
52
- (import_declaration (import_spec) @name)
53
-
54
- (
55
- (source_file
56
- (var_declaration
57
- [
58
- (var_spec name: (identifier) @name) @definition.variable
59
- (var_spec_list
60
- (var_spec name: (identifier) @name) @definition.variable)
61
- ]))
62
- (#not-eq? @name "_")
63
- )
64
-
65
- (
66
- (source_file
67
- (const_declaration
68
- (const_spec name: (identifier) @name) @definition.constant))
69
- (#not-eq? @name "_")
70
- )