@willbooster/tree-sitter-python 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-python",
3
- "version": "0.0.0-placeholder.0",
4
- "description": "Placeholder for WillBooster's fork of tree-sitter-python; the first release is 1.0.0",
3
+ "version": "1.0.0",
4
+ "description": "Python grammar for tree-sitter",
5
+ "keywords": [
6
+ "incremental",
7
+ "parsing",
8
+ "tree-sitter",
9
+ "python"
10
+ ],
5
11
  "repository": {
6
12
  "type": "git",
7
13
  "url": "git+https://github.com/WillBooster/tree-sitter-python.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,137 @@
1
+ ; Identifier naming conventions
2
+
3
+ (identifier) @variable
4
+
5
+ ((identifier) @constructor
6
+ (#match? @constructor "^[A-Z]"))
7
+
8
+ ((identifier) @constant
9
+ (#match? @constant "^[A-Z][A-Z_]*$"))
10
+
11
+ ; Function calls
12
+
13
+ (decorator) @function
14
+ (decorator
15
+ (identifier) @function)
16
+
17
+ (call
18
+ function: (attribute attribute: (identifier) @function.method))
19
+ (call
20
+ function: (identifier) @function)
21
+
22
+ ; Builtin functions
23
+
24
+ ((call
25
+ function: (identifier) @function.builtin)
26
+ (#match?
27
+ @function.builtin
28
+ "^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
29
+
30
+ ; Function definitions
31
+
32
+ (function_definition
33
+ name: (identifier) @function)
34
+
35
+ (attribute attribute: (identifier) @property)
36
+ (type (identifier) @type)
37
+
38
+ ; Literals
39
+
40
+ [
41
+ (none)
42
+ (true)
43
+ (false)
44
+ ] @constant.builtin
45
+
46
+ [
47
+ (integer)
48
+ (float)
49
+ ] @number
50
+
51
+ (comment) @comment
52
+ (string) @string
53
+ (escape_sequence) @escape
54
+
55
+ (interpolation
56
+ "{" @punctuation.special
57
+ "}" @punctuation.special) @embedded
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
+ ">"
89
+ ">="
90
+ ">>"
91
+ ">>="
92
+ "|"
93
+ "|="
94
+ "~"
95
+ "@="
96
+ "and"
97
+ "in"
98
+ "is"
99
+ "not"
100
+ "or"
101
+ "is not"
102
+ "not in"
103
+ ] @operator
104
+
105
+ [
106
+ "as"
107
+ "assert"
108
+ "async"
109
+ "await"
110
+ "break"
111
+ "class"
112
+ "continue"
113
+ "def"
114
+ "del"
115
+ "elif"
116
+ "else"
117
+ "except"
118
+ "exec"
119
+ "finally"
120
+ "for"
121
+ "from"
122
+ "global"
123
+ "if"
124
+ "import"
125
+ "lambda"
126
+ "nonlocal"
127
+ "pass"
128
+ "print"
129
+ "raise"
130
+ "return"
131
+ "try"
132
+ "while"
133
+ "with"
134
+ "yield"
135
+ "match"
136
+ "case"
137
+ ] @keyword
@@ -0,0 +1,14 @@
1
+ (module (expression_statement (assignment left: (identifier) @name) @definition.constant))
2
+
3
+ (class_definition
4
+ name: (identifier) @name) @definition.class
5
+
6
+ (function_definition
7
+ name: (identifier) @name) @definition.function
8
+
9
+ (call
10
+ function: [
11
+ (identifier) @name
12
+ (attribute
13
+ attribute: (identifier) @name)
14
+ ]) @reference.call