@willbooster/tree-sitter-python 2.0.1 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-python",
3
- "version": "2.0.1",
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.1",
22
+ "version": "2.0.2",
23
23
  "license": "MIT",
24
24
  "description": "Python grammar for tree-sitter",
25
25
  "authors": [