@willbooster/tree-sitter-python 2.0.0 → 2.0.2

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
@@ -115,12 +115,14 @@ and the release build regenerate the parsers before compiling them.
115
115
  (ten times the lines take about ten times the CPU time, under a ceiling), since consumers parse files while they are
116
116
  being edited. It loads the Wasm build through @willbooster/web-tree-sitter, which `bun run build/ci` rebuilds after
117
117
  regenerating the parser;
118
+ - a native CLI crash regression for deeply indented strings (`test/unit/deepIndentation.test.ts`);
118
119
  - a check that `package.json` and `Cargo.lock` test the same runtime version (`test/unit/runtimeVersion.test.ts`);
119
120
  - checks that the Wasm build parses in Chromium (`test/unit/browser/`) and in Cloudflare Workers with and without
120
121
  Node.js compatibility (`test/unit/workerd.test.ts`). Run `bun run test/ci-setup` once to install Chromium.
121
122
 
122
- The tests and `script/parse-examples` compile the parser into `.tmp/tree-sitter-lib` rather than the CLI's cache shared
123
- by every checkout; `script/fuzz-corpus` builds a per-run parser in `.tmp/fuzz` and deletes it afterwards.
123
+ Tests and `script/parse-examples` keep native parser builds under this checkout's `.tmp/` instead of the CLI cache shared by every checkout.
124
+ See `test/unit/run.ts`, `test/unit/deepIndentation.test.ts`, `script/fuzz-corpus`, and `script/parse-examples`
125
+ for their build locations and cleanup.
124
126
 
125
127
  CI also runs these tests on Linux arm64 and macOS, where the CLI compiles the parser and the scanner with the platform's
126
128
  C compiler as the crate does for its users, and fuzzes the parser with libFuzzer and sanitizers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-python",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Python grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -6,7 +6,7 @@
6
6
  (#match? @constructor "^[A-Z]"))
7
7
 
8
8
  ((identifier) @constant
9
- (#match? @constant "^[A-Z][A-Z_]*$"))
9
+ (#match? @constant "^[0-9_]*[A-Z][A-Z_0-9]*$"))
10
10
 
11
11
  ; Function calls
12
12
 
@@ -32,6 +32,35 @@
32
32
  (function_definition
33
33
  name: (identifier) @function)
34
34
 
35
+ ; Later patterns override naming heuristics in syntactically known class positions.
36
+
37
+ ((class_definition
38
+ name: (identifier) @constructor)
39
+ (#match? @constructor "^[0-9_]*[A-Z][A-Z_0-9]*$"))
40
+
41
+ ((class_definition
42
+ superclasses: (argument_list (identifier) @constructor))
43
+ (#match? @constructor "^[0-9_]*[A-Z][A-Z_0-9]*$"))
44
+
45
+ ((class_definition
46
+ superclasses: (argument_list (subscript value: (identifier) @constructor)))
47
+ (#match? @constructor "^[0-9_]*[A-Z][A-Z_0-9]*$"))
48
+
49
+ ((except_clause value: [
50
+ (identifier) @constructor
51
+ (tuple (identifier) @constructor)
52
+ (parenthesized_expression (identifier) @constructor)
53
+ (as_pattern [
54
+ (identifier) @constructor
55
+ (tuple (identifier) @constructor)
56
+ (parenthesized_expression (identifier) @constructor)
57
+ ])
58
+ ])
59
+ (#match? @constructor "^[0-9_]*[A-Z][A-Z_0-9]*$"))
60
+
61
+ ((class_pattern (dotted_name (identifier) @constructor .))
62
+ (#match? @constructor "^[0-9_]*[A-Z][A-Z_0-9]*$"))
63
+
35
64
  (attribute attribute: (identifier) @property)
36
65
  (type (identifier) @type)
37
66
 
Binary file
package/tree-sitter.json CHANGED
@@ -19,7 +19,7 @@
19
19
  }
20
20
  ],
21
21
  "metadata": {
22
- "version": "2.0.0",
22
+ "version": "2.0.2",
23
23
  "license": "MIT",
24
24
  "description": "Python grammar for tree-sitter",
25
25
  "authors": [