@willbooster/tree-sitter-ruby 0.0.0-placeholder.0 → 1.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/package.json CHANGED
@@ -1,13 +1,75 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-ruby",
3
- "version": "0.0.0-placeholder.0",
4
- "description": "Placeholder for WillBooster's fork of tree-sitter-ruby; the first release is 1.0.0",
3
+ "version": "1.0.0",
4
+ "description": "Ruby grammar for tree-sitter",
5
+ "keywords": [
6
+ "incremental",
7
+ "parsing",
8
+ "tree-sitter",
9
+ "ruby"
10
+ ],
5
11
  "repository": {
6
12
  "type": "git",
7
13
  "url": "git+https://github.com/WillBooster/tree-sitter-ruby.git"
8
14
  },
9
15
  "license": "MIT",
10
16
  "author": "WillBooster Inc.",
17
+ "files": [
18
+ "grammar.js",
19
+ "queries/*.scm",
20
+ "tree-sitter.json",
21
+ "src/node-types.json",
22
+ "*.wasm"
23
+ ],
24
+ "scripts": {
25
+ "build-wasm": "script/generate --build-wasm",
26
+ "build/ci": "bun run build-wasm",
27
+ "cleanup": "bun wb lint --fix --format",
28
+ "format": "bun wb lint --format",
29
+ "generate": "script/generate",
30
+ "lint": "bun wb lint",
31
+ "lint-fix": "bun wb lint --fix",
32
+ "prepare": "(bun lefthook install || true) && (test ! -f .lefthook/normalize-bun-lockfile.sh || bash .lefthook/normalize-bun-lockfile.sh)",
33
+ "release": "wb release",
34
+ "prestart": "bun run build-wasm",
35
+ "start": "script/tree-sitter playground",
36
+ "test": "bun wb test",
37
+ "test/ci": "bun wb test-on-ci",
38
+ "test/ci-setup": "playwright install chromium",
39
+ "typecheck": "bun wb typecheck",
40
+ "verify": "bun wb verify",
41
+ "verify-full": "bun wb verify --full"
42
+ },
43
+ "devDependencies": {
44
+ "@tsconfig/bun": "1.0.11",
45
+ "@types/bun": "1.4.2",
46
+ "@vitest/browser-playwright": "5.0.3",
47
+ "@willbooster/oxfmt-config": "1.2.2",
48
+ "@willbooster/oxlint-config": "1.4.8",
49
+ "@willbooster/wb": "22.24.0",
50
+ "@willbooster/web-tree-sitter": "1.4.7",
51
+ "conventional-changelog-conventionalcommits": "10.4.0",
52
+ "lefthook": "2.1.16",
53
+ "oxfmt": "0.71.0",
54
+ "oxlint": "1.86.0",
55
+ "oxlint-tsgolint": "7.0.2003",
56
+ "playwright": "1.63.0",
57
+ "semantic-release": "25.0.9",
58
+ "sort-package-json": "4.0.0",
59
+ "tree-sitter-cli": "0.27.0",
60
+ "typescript": "7.0.2",
61
+ "vite": "8.3.2",
62
+ "vitest": "5.0.3",
63
+ "wrangler": "4.147.0"
64
+ },
65
+ "peerDependencies": {
66
+ "@willbooster/web-tree-sitter": "^1.3.0"
67
+ },
68
+ "peerDependenciesMeta": {
69
+ "@willbooster/web-tree-sitter": {
70
+ "optional": true
71
+ }
72
+ },
11
73
  "publishConfig": {
12
74
  "access": "public",
13
75
  "registry": "https://registry.npmjs.org/"
@@ -0,0 +1,154 @@
1
+ (identifier) @variable
2
+
3
+ ((identifier) @function.method
4
+ (#is-not? local))
5
+
6
+ [
7
+ "alias"
8
+ "and"
9
+ "begin"
10
+ "break"
11
+ "case"
12
+ "class"
13
+ "def"
14
+ "do"
15
+ "else"
16
+ "elsif"
17
+ "end"
18
+ "ensure"
19
+ "for"
20
+ "if"
21
+ "in"
22
+ "module"
23
+ "next"
24
+ "or"
25
+ "rescue"
26
+ "retry"
27
+ "return"
28
+ "then"
29
+ "unless"
30
+ "until"
31
+ "when"
32
+ "while"
33
+ "yield"
34
+ ] @keyword
35
+
36
+ ((identifier) @keyword
37
+ (#match? @keyword "^(private|protected|public)$"))
38
+
39
+ (constant) @constructor
40
+
41
+ ; Function calls
42
+
43
+ "defined?" @function.method.builtin
44
+
45
+ (call
46
+ method: [(identifier) (constant)] @function.method)
47
+
48
+ ((identifier) @function.method.builtin
49
+ (#eq? @function.method.builtin "require"))
50
+
51
+ ; Function definitions
52
+
53
+ (alias (identifier) @function.method)
54
+ (setter (identifier) @function.method)
55
+ (method name: [(identifier) (constant)] @function.method)
56
+ (singleton_method name: [(identifier) (constant)] @function.method)
57
+
58
+ ; Identifiers
59
+
60
+ [
61
+ (class_variable)
62
+ (instance_variable)
63
+ ] @property
64
+
65
+ ((identifier) @constant.builtin
66
+ (#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
67
+
68
+ (file) @constant.builtin
69
+ (line) @constant.builtin
70
+ (encoding) @constant.builtin
71
+
72
+ (hash_splat_nil
73
+ "**" @operator) @constant.builtin
74
+
75
+ ((constant) @constant
76
+ (#match? @constant "^[A-Z\\d_]+$"))
77
+
78
+ [
79
+ (self)
80
+ (super)
81
+ ] @variable.builtin
82
+
83
+ (block_parameter (identifier) @variable.parameter)
84
+ (block_parameters (identifier) @variable.parameter)
85
+ (destructured_parameter (identifier) @variable.parameter)
86
+ (hash_splat_parameter (identifier) @variable.parameter)
87
+ (lambda_parameters (identifier) @variable.parameter)
88
+ (method_parameters (identifier) @variable.parameter)
89
+ (splat_parameter (identifier) @variable.parameter)
90
+
91
+ (keyword_parameter name: (identifier) @variable.parameter)
92
+ (optional_parameter name: (identifier) @variable.parameter)
93
+
94
+ ; Literals
95
+
96
+ [
97
+ (string)
98
+ (bare_string)
99
+ (subshell)
100
+ (heredoc_body)
101
+ (heredoc_beginning)
102
+ ] @string
103
+
104
+ [
105
+ (simple_symbol)
106
+ (delimited_symbol)
107
+ (hash_key_symbol)
108
+ (bare_symbol)
109
+ ] @string.special.symbol
110
+
111
+ (regex) @string.special.regex
112
+ (escape_sequence) @escape
113
+
114
+ [
115
+ (integer)
116
+ (float)
117
+ ] @number
118
+
119
+ [
120
+ (nil)
121
+ (true)
122
+ (false)
123
+ ] @constant.builtin
124
+
125
+ (interpolation
126
+ "#{" @punctuation.special
127
+ "}" @punctuation.special) @embedded
128
+
129
+ (comment) @comment
130
+
131
+ ; Operators
132
+
133
+ [
134
+ "="
135
+ "=>"
136
+ "->"
137
+ ] @operator
138
+
139
+ [
140
+ ","
141
+ ";"
142
+ "."
143
+ ] @punctuation.delimiter
144
+
145
+ [
146
+ "("
147
+ ")"
148
+ "["
149
+ "]"
150
+ "{"
151
+ "}"
152
+ "%w("
153
+ "%i("
154
+ ] @punctuation.bracket
@@ -0,0 +1,27 @@
1
+ ((method) @local.scope
2
+ (#set! local.scope-inherits false))
3
+
4
+ [
5
+ (lambda)
6
+ (block)
7
+ (do_block)
8
+ ] @local.scope
9
+
10
+ (block_parameter (identifier) @local.definition)
11
+ (block_parameters (identifier) @local.definition)
12
+ (destructured_parameter (identifier) @local.definition)
13
+ (hash_splat_parameter (identifier) @local.definition)
14
+ (lambda_parameters (identifier) @local.definition)
15
+ (method_parameters (identifier) @local.definition)
16
+ (splat_parameter (identifier) @local.definition)
17
+
18
+ (keyword_parameter name: (identifier) @local.definition)
19
+ (optional_parameter name: (identifier) @local.definition)
20
+
21
+ (identifier) @local.reference
22
+
23
+ (assignment left: (identifier) @local.definition)
24
+ (operator_assignment left: (identifier) @local.definition)
25
+ (left_assignment_list (identifier) @local.definition)
26
+ (rest_assignment (identifier) @local.definition)
27
+ (destructured_left_assignment (identifier) @local.definition)
@@ -0,0 +1,64 @@
1
+ ; Method definitions
2
+
3
+ (
4
+ (comment)* @doc
5
+ .
6
+ [
7
+ (method
8
+ name: (_) @name) @definition.method
9
+ (singleton_method
10
+ name: (_) @name) @definition.method
11
+ ]
12
+ (#strip! @doc "^#\\s*")
13
+ (#select-adjacent! @doc @definition.method)
14
+ )
15
+
16
+ (alias
17
+ name: (_) @name) @definition.method
18
+
19
+ (setter
20
+ (identifier) @ignore)
21
+
22
+ ; Class definitions
23
+
24
+ (
25
+ (comment)* @doc
26
+ .
27
+ [
28
+ (class
29
+ name: [
30
+ (constant) @name
31
+ (scope_resolution
32
+ name: (_) @name)
33
+ ]) @definition.class
34
+ (singleton_class
35
+ value: [
36
+ (constant) @name
37
+ (scope_resolution
38
+ name: (_) @name)
39
+ ]) @definition.class
40
+ ]
41
+ (#strip! @doc "^#\\s*")
42
+ (#select-adjacent! @doc @definition.class)
43
+ )
44
+
45
+ ; Module definitions
46
+
47
+ (
48
+ (module
49
+ name: [
50
+ (constant) @name
51
+ (scope_resolution
52
+ name: (_) @name)
53
+ ]) @definition.module
54
+ )
55
+
56
+ ; Calls
57
+
58
+ (call method: (identifier) @name) @reference.call
59
+
60
+ (
61
+ [(identifier) (constant)] @name @reference.call
62
+ (#is-not? local)
63
+ (#not-match? @name "^(lambda|load|require|require_relative|__FILE__|__LINE__)$")
64
+ )