File tree 4 files changed +40
-3
lines changed
main/kotlin/chapi/ast/helper
test/kotlin/chapi/ast/helper
4 files changed +40
-3
lines changed Original file line number Diff line number Diff line change
1
+ plugins {
2
+ java
3
+ kotlin(" jvm" )
4
+ kotlin(" plugin.serialization" ) version " 1.6.10"
5
+
6
+ `jacoco- conventions`
7
+ }
8
+
9
+ dependencies {
10
+ implementation(" org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2" )
11
+ implementation(kotlin(" stdlib-jdk8" ))
12
+ implementation(kotlin(" reflect" ))
13
+
14
+ implementation(" org.antlr:antlr4:4.11.1" )
15
+ implementation(" org.antlr:antlr4-runtime:4.11.1" )
16
+ // Kotlin reflection.
17
+ implementation(kotlin(" test" ))
18
+ implementation(kotlin(" test-junit" ))
19
+
20
+ testImplementation(project(" :chapi-ast-java" ))
21
+ testImplementation(project(" :chapi-domain" ))
22
+
23
+ // JUnit 5
24
+ testImplementation(" org.junit.jupiter:junit-jupiter-api:5.6.0" )
25
+ testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine:5.6.0" )
26
+ testRuntimeOnly(" org.junit.platform:junit-platform-console:1.6.0" )
27
+ }
28
+
29
+ tasks.withType<Test > {
30
+ useJUnitPlatform()
31
+ testLogging {
32
+ events(" passed" , " skipped" , " failed" )
33
+ }
34
+ }
Original file line number Diff line number Diff line change 1
- package chapi.ast.javaast
1
+ package chapi.ast.helper
2
2
3
3
import org.antlr.v4.runtime.misc.Utils;
4
4
import org.antlr.v4.runtime.tree.Tree;
Original file line number Diff line number Diff line change 1
- package chapi.ast.javaast
1
+ package chapi.ast.helper
2
2
3
+ import chapi.ast.javaast.JavaAnalyser
3
4
import org.junit.jupiter.api.Test
4
5
5
6
internal class TreeViewerTest {
6
7
@Test
7
8
fun show () {
8
- JavaAnalyser ().parse(" public class Test { }" ).let {
9
+ val javaAnalyser = JavaAnalyser ()
10
+ javaAnalyser.parse(" public class Test { }" ).let {
9
11
val ruleNamesList: List <String > = it.ruleNames.toList()
10
12
println (TreeViewer ().toPrettyTree(it.compilationUnit(), ruleNamesList))
11
13
}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ rootProject.name = "chapi"
2
2
3
3
include(
4
4
" :chapi-domain" ,
5
+ " :chapi-helper" ,
5
6
// tier 1 languages
6
7
" :chapi-ast-java" ,
7
8
" :chapi-ast-typescript" ,
You can’t perform that action at this time.
0 commit comments