@dekobon/tree-sitter-groovy 0.5.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/README.md +25 -4
- package/grammar.js +627 -129
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/@dekobon+tree-sitter-groovy.node +0 -0
- package/prebuilds/linux-x64/@dekobon+tree-sitter-groovy.node +0 -0
- package/prebuilds/win32-x64/@dekobon+tree-sitter-groovy.node +0 -0
- package/queries/groovy/highlights.scm +10 -4
- package/queries/groovy/locals.scm +7 -0
- package/queries/groovy/tags.scm +32 -0
- package/src/grammar.json +1765 -442
- package/src/node-types.json +593 -3
- package/src/parser.c +194884 -146231
- package/src/scanner.c +275 -24
- package/tree-sitter.json +2 -1
package/README.md
CHANGED
|
@@ -180,13 +180,34 @@ These are documented in detail in
|
|
|
180
180
|
closure, as in Groovy: end the field with `;` to get an
|
|
181
181
|
initializer block.
|
|
182
182
|
- **`sealed` and `trait` are keywords where a class member can
|
|
183
|
-
start** -- a field
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
start** -- a field named `sealed` or `trait` is an `ERROR` when it
|
|
184
|
+
follows a modifier (`private boolean sealed`) or opens the member
|
|
185
|
+
(`static trait = 1`). `boolean sealed` and `String trait`, with no
|
|
186
|
+
modifier, parse, and so does an enum constant with either name
|
|
187
|
+
(`enum E { trait, sealed }`).
|
|
187
188
|
`record` is not affected: it is a keyword only directly before a
|
|
188
189
|
record header (`record Name(`), so `private Record record` and
|
|
189
190
|
`record.key()` parse.
|
|
191
|
+
- **A member after an enum's trailing comma must start with a
|
|
192
|
+
modifier, `def` or a keyword** -- Groovy up to 4.x takes any member
|
|
193
|
+
there. `A,` followed by `String x` or by `E() { }` is an `ERROR`
|
|
194
|
+
(#97).
|
|
195
|
+
- **Parameter modifiers have one order** -- annotations, then `final`,
|
|
196
|
+
then `def`, `var` or a type. `def String x`, `final @A x` and a
|
|
197
|
+
varargs parameter with no type (`... xs`) are an `ERROR` (#98).
|
|
198
|
+
- **A line break does not end a statement** -- a newline is whitespace
|
|
199
|
+
to the grammar. Most code is unaffected, because the next token
|
|
200
|
+
cannot continue the statement. Known cases that read wrongly with no
|
|
201
|
+
`ERROR`: a bare name followed by a literal on the next line is one
|
|
202
|
+
parenthesis-free call (#90); a field with a modifier and no type
|
|
203
|
+
followed by a typed method is a typed field and a constructor (#96);
|
|
204
|
+
and inside brackets, `(a)` followed by a line that starts with `-`,
|
|
205
|
+
`+` or `(` is not the cast Groovy reads (#99).
|
|
206
|
+
- **A method with modifiers and no return type is a constructor** --
|
|
207
|
+
`static f() { }` in a class body is a `constructor_declaration`,
|
|
208
|
+
and `abstract m()` is an `ERROR` (#91).
|
|
209
|
+
- **Annotations come before modifiers** -- `private @Autowired Foo
|
|
210
|
+
foo` and `public @interface X { }` are an `ERROR` (#92).
|
|
190
211
|
|
|
191
212
|
## Contributing
|
|
192
213
|
|