@willbooster/tree-sitter-go 2.1.3 → 3.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.36.11-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
8
+ [![wbfy](https://img.shields.io/badge/wbfy-20.41.8-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
@@ -14,13 +14,13 @@ to its authors and contributors. This is not an official release of that project
14
14
 
15
15
  This fork extends upstream's version 0.25.0 grammar with method type parameters and generates the parser with the
16
16
  [WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parser carries that fork's own ABI
17
- number (`0x57420001`), so it loads only with the WillBooster runtime, version 2.0.0 or later
17
+ number (`0x57420006`), so it loads only with the WillBooster runtime, version 7.0.5 or later
18
18
  (`willbooster-tree-sitter`, `@willbooster/web-tree-sitter`), and not with upstream's tree-sitter.
19
19
 
20
20
  ## Usage
21
21
 
22
22
  The npm package ships `tree-sitter-go.wasm` for
23
- [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 2.0.0 or later, which runs in Node.js, Bun, browsers, and Cloudflare Workers. In Node.js and Bun, load the grammar from its path:
23
+ [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 7.0.5 or later, which runs in Node.js, Bun, browsers, and Cloudflare Workers. In Node.js and Bun, load the grammar from its path:
24
24
 
25
25
  ```js
26
26
  import { fileURLToPath } from 'node:url';
@@ -66,8 +66,8 @@ fuzzed with:
66
66
 
67
67
  ```toml
68
68
  [dependencies]
69
- tree-sitter = { package = "willbooster-tree-sitter", version = "2" }
70
- tree-sitter-go = { package = "willbooster-tree-sitter-go", version = "2" }
69
+ tree-sitter = { package = "willbooster-tree-sitter", version = "7.0.5" }
70
+ tree-sitter-go = { package = "willbooster-tree-sitter-go", version = "3" }
71
71
  ```
72
72
 
73
73
  ```rust
package/grammar.js CHANGED
@@ -85,15 +85,17 @@ module.exports = grammar({
85
85
  word: $ => $.identifier,
86
86
 
87
87
  conflicts: $ => [
88
+ [$._generic_function, $._expression],
89
+ [$._generic_function, $._simple_type, $._expression],
90
+ [$._generic_function, $._simple_type, $.generic_type, $._expression],
91
+ [$._generic_function, $.type_parameter_declaration, $._simple_type, $.generic_type, $._expression],
88
92
  [$._simple_type, $._expression],
89
- [$._simple_type, $.generic_type, $._expression],
90
93
  [$.qualified_type, $._expression],
91
94
  [$.generic_type, $._simple_type],
92
95
  [$.parameter_declaration, $._simple_type],
93
96
  [$.type_parameter_declaration, $._simple_type],
94
97
  [$.type_parameter_declaration, $._simple_type, $._expression],
95
98
  [$.type_parameter_declaration, $._expression],
96
- [$.type_parameter_declaration, $._simple_type, $.generic_type, $._expression],
97
99
  ],
98
100
 
99
101
  reserved: {
@@ -690,14 +692,26 @@ module.exports = grammar({
690
692
  ')',
691
693
  ),
692
694
 
695
+ _generic_function: $ => choice(
696
+ $.identifier,
697
+ $.selector_expression,
698
+ alias($._parenthesized_generic_function, $.parenthesized_expression),
699
+ ),
700
+
701
+ _parenthesized_generic_function: $ => seq('(', $._generic_function, ')'),
702
+
693
703
  call_expression: $ => prec(PREC.primary, choice(
694
704
  seq(
695
705
  field('function', alias(choice('new', 'make'), $.identifier)),
696
706
  field('arguments', alias($.special_argument_list, $.argument_list)),
697
707
  ),
708
+ seq(
709
+ field('function', $._generic_function),
710
+ field('type_arguments', prec.dynamic(2, $.type_arguments)),
711
+ field('arguments', $.argument_list),
712
+ ),
698
713
  seq(
699
714
  field('function', $._expression),
700
- field('type_arguments', optional($.type_arguments)),
701
715
  field('arguments', $.argument_list),
702
716
  ),
703
717
  )),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-go",
3
- "version": "2.1.3",
3
+ "version": "3.0.0",
4
4
  "description": "Go grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -47,21 +47,20 @@
47
47
  "@willbooster/oxfmt-config": "1.2.2",
48
48
  "@willbooster/oxlint-config": "1.4.8",
49
49
  "@willbooster/wb": "22.26.1",
50
- "@willbooster/web-tree-sitter": "2.0.25",
50
+ "@willbooster/web-tree-sitter": "7.0.5",
51
51
  "conventional-changelog-conventionalcommits": "10.4.1",
52
52
  "lefthook": "2.2.1",
53
53
  "oxfmt": "0.72.0",
54
54
  "oxlint": "1.87.0",
55
- "oxlint-tsgolint": "7.0.2003",
55
+ "oxlint-tsgolint": "7.0.2004",
56
56
  "playwright": "1.64.0",
57
57
  "semantic-release": "25.0.9",
58
58
  "sort-package-json": "4.0.0",
59
- "typescript": "7.0.2",
60
59
  "vitest": "5.0.3",
61
60
  "wrangler": "4.149.0"
62
61
  },
63
62
  "peerDependencies": {
64
- "@willbooster/web-tree-sitter": "^2.0.0"
63
+ "@willbooster/web-tree-sitter": "^7.0.5"
65
64
  },
66
65
  "peerDependenciesMeta": {
67
66
  "@willbooster/web-tree-sitter": {
Binary file
package/tree-sitter.json CHANGED
@@ -14,7 +14,7 @@
14
14
  }
15
15
  ],
16
16
  "metadata": {
17
- "version": "2.1.3",
17
+ "version": "3.0.0",
18
18
  "license": "MIT",
19
19
  "description": "Go grammar for tree-sitter",
20
20
  "authors": [