@@ -9,6 +9,7 @@ while introducing support for those that were completely absent from the origina
9
9
Highlights include:
10
10
11
11
- Incremental abstract syntax tree edits
12
+ - Parser and lexer debugging through loggers
12
13
- APIs for querying parsed abstract syntax trees
13
14
- Support for both macOS and Linux out of the box
14
15
- A wide range of languages [ supported] ( .gitmodules ) out of the box
@@ -51,10 +52,10 @@ For it to work, you must have the following installed:
51
52
52
53
| Dependency | Version |
53
54
| :-----------| --------:|
54
- | Java | 11+ |
55
- | Maven | 3.9+ |
56
- | Python | 3.9 |
57
- | Docker | 23+ |
55
+ | Java | 11 |
56
+ | Maven | 3.9 |
57
+ | Python | 3.10 |
58
+ | Docker | 23 |
58
59
59
60
## Adding dependency to project
60
61
@@ -64,7 +65,7 @@ To use in your own Maven project, include the following in your POM file:
64
65
<dependency >
65
66
<groupId >ch.usi.si.seart</groupId >
66
67
<artifactId >java-tree-sitter</artifactId >
67
- <version >1.11 .0</version >
68
+ <version >1.12 .0</version >
68
69
</dependency >
69
70
```
70
71
@@ -205,5 +206,27 @@ public class Example {
205
206
}
206
207
```
207
208
209
+ If you would like to debug the parsing process, you can attach loggers directly to a ` Parser ` :
210
+
211
+ ``` java
212
+ import ch.usi.si.seart.treesitter.* ;
213
+ import org.slf4j.* ;
214
+
215
+ public class Example {
216
+
217
+ // init omitted...
218
+
219
+ public static void main (String [] args ) {
220
+ Logger logger = LoggerFactory . getLogger(Example . class);
221
+ try (Parser parser = Parser . getFor(Language . PYTHON )) {
222
+ parser. setLogger(logger);
223
+ parser. parse(" pass" ). close();
224
+ } catch (Exception ex) {
225
+ // ...
226
+ }
227
+ }
228
+ }
229
+ ```
230
+
208
231
For more usage examples, take a look at the [ tests] ( src/test/java/ch/usi/si/seart/treesitter ) .
209
232
You can also refer to the full documentation [ here] ( https://javadoc.io/doc/ch.usi.si.seart/java-tree-sitter/latest/index.html ) .
0 commit comments