add java queries (#225)

* add java queries

* remove unused alternation in java

* add example java test file
This commit is contained in:
Andy Bell 2023-03-11 22:55:52 +00:00 committed by GitHub
parent 67dcaf9d91
commit f35bc54731
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 0 deletions

21
queries/java/context.scm Normal file
View file

@ -0,0 +1,21 @@
(if_statement
consequence: (_) @context.end
) @context
(method_declaration
body: (_) @context.end
) @context
(for_statement
body: (_) @context.end
) @context
(enhanced_for_statement
body: (_) @context.end
) @context
(class_declaration
body: (_) @context.end
) @context
(expression_statement) @context

44
test/test.java Normal file
View file

@ -0,0 +1,44 @@
package mymod;
import stuff1;
import stuff2;
@class_annot_1
@class_annot_2
public class MyClass {
@method_annot_1
@method_annot_2
public void my_method(int param) {
if (true) {
for (int i = 0; i < 10; i++) {
for (int var : iterable) {
System.
out.println("a message");
}
}
}
}
}