@dekobon/tree-sitter-groovy 0.4.0 → 0.6.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@dekobon/tree-sitter-groovy",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Apache Groovy grammar for tree-sitter (dekobon fork)",
5
5
  "main": "bindings/node",
6
6
  "types": "bindings/node",
@@ -97,6 +97,8 @@
97
97
  ".@"
98
98
  "::"
99
99
  "*:"
100
+ "->"
101
+ "..."
100
102
  ] @operator
101
103
 
102
104
  ; -- Layer 3: generic identifier fallback --------------------------
@@ -112,10 +114,10 @@
112
114
  "instanceof"
113
115
  ] @keyword.operator
114
116
 
115
- ; `!in` and `!instanceof` are composite tokens (literal + trailing
116
- ; whitespace) per SPECIFICATION.md §3.2.2 lexer rule, so they
117
- ; cannot be referenced as direct anonymous tokens in a `[ … ]`
118
- ; group. Capture them through the operator field instead.
117
+ ; `!instanceof` is a composite token (literal + trailing whitespace)
118
+ ; per SPECIFICATION.md §3.2.2, so it cannot be referenced as a direct
119
+ ; anonymous token in a `[ … ]` group. Capture it, and `!in` with it,
120
+ ; through the operator field instead.
119
121
  (membership_expression operator: _ @keyword.operator)
120
122
  (instanceof_expression operator: _ @keyword.operator)
121
123
 
@@ -172,6 +174,10 @@
172
174
  "strictfp"
173
175
  ] @keyword.modifier
174
176
 
177
+ ; `synchronized (lock) { … }` is a statement; the word is a modifier
178
+ ; everywhere else.
179
+ (synchronized_statement "synchronized" @keyword)
180
+
175
181
  (shebang) @keyword.directive
176
182
 
177
183
  ; -- Layer 5: dot-family property captures -------------------------
@@ -8,6 +8,8 @@
8
8
  ; Scopes — anywhere a new symbol table is opened.
9
9
  [
10
10
  (class_body)
11
+ (enum_body)
12
+ (record_declaration)
11
13
  (block)
12
14
  (closure)
13
15
  (method_declaration)
@@ -16,12 +18,17 @@
16
18
  (for_statement)
17
19
  (for_in_statement)
18
20
  (catch_clause)
21
+ (try_statement)
19
22
  ] @local.scope
20
23
 
21
24
  ; Definitions — bound names introduced inside their enclosing scope.
22
25
  (formal_parameter name: (identifier) @local.definition.parameter)
23
26
  (closure_parameter name: (identifier) @local.definition.parameter)
24
27
  (variable_declarator name: (identifier) @local.definition.var)
28
+ ; A typed local has its name on the declaration itself, with no
29
+ ; `variable_declarator`: `String s = 'a'`, `final String s`.
30
+ (local_variable_declaration name: (identifier) @local.definition.var)
31
+ (resource name: (identifier) @local.definition.var)
25
32
  (field_declaration
26
33
  (variable_declarator name: (identifier) @local.definition.field))
27
34
  (for_in_statement variable: (identifier) @local.definition.var)
@@ -65,3 +65,35 @@
65
65
  (super_interfaces (type_identifier) @name) @reference.implementation
66
66
 
67
67
  (extends_interfaces (type_identifier) @name) @reference.implementation
68
+
69
+ ; A generic super type is tagged by its base, and a qualified one by
70
+ ; its last segment: `implements Supplier<String>, a.b.Shaded`.
71
+ (superclass
72
+ (generic_type base: (type_identifier) @name)) @reference.class
73
+
74
+ (superclass
75
+ (qualified_type (type_identifier) @name .)) @reference.class
76
+
77
+ (superclass
78
+ (generic_type
79
+ base: (qualified_type (type_identifier) @name .))) @reference.class
80
+
81
+ (super_interfaces
82
+ (generic_type base: (type_identifier) @name)) @reference.implementation
83
+
84
+ (super_interfaces
85
+ (qualified_type (type_identifier) @name .)) @reference.implementation
86
+
87
+ (super_interfaces
88
+ (generic_type
89
+ base: (qualified_type (type_identifier) @name .))) @reference.implementation
90
+
91
+ (extends_interfaces
92
+ (generic_type base: (type_identifier) @name)) @reference.implementation
93
+
94
+ (extends_interfaces
95
+ (qualified_type (type_identifier) @name .)) @reference.implementation
96
+
97
+ (extends_interfaces
98
+ (generic_type
99
+ base: (qualified_type (type_identifier) @name .))) @reference.implementation