Skip to content

Commit 2208862

Browse files
committed
feat(ast): add Swift5 parser module
Add new :chapi-ast-swift module based on grammars-v4 swift5 grammar with minimal analyser + listener, plus basic tests and README updates. Closes #49.
1 parent 2c57df9 commit 2208862

11 files changed

Lines changed: 2914 additions & 7 deletions

File tree

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ Chapi (pronounced /tʃɑpi/) can also be read as “XP” in Chinese if you pron
2222

2323
### Language stages
2424

25-
| Feature | Java | Python | Go | Kotlin | TS/JS | C | C# | Scala | C++ | Rust |
26-
|----------------|------|--------|----|--------|-------|----|----|-------|-----|------|
27-
| HTTP API decl || 🆕 |||| 🆕 ||| 🆕 ||
28-
| Syntax parsing |||||||||||
29-
| Function calls |||||||| | ||
30-
| Arch/package || |||| 🆕 |||||
31-
| Real-world || | ||| | | | | |
25+
| Feature | Java | Python | Go | Kotlin | TS/JS | C | C# | Scala | C++ | Rust | Swift |
26+
|----------------|------|--------|----|--------|-------|----|----|-------|-----|------|-------|
27+
| HTTP API decl || 🆕 |||| 🆕 ||| 🆕 || |
28+
| Syntax parsing ||||||||||| 🆕 |
29+
| Function calls |||||||| | || |
30+
| Arch/package || |||| 🆕 ||||| |
31+
| Real-world || | ||| | | | | | |
3232

3333
### IDL stages
3434

@@ -82,6 +82,7 @@ Gradle modules (by tier):
8282
":chapi-ast-csharp",
8383
":chapi-ast-c",
8484
":chapi-ast-cpp",
85+
":chapi-ast-swift",
8586
8687
// others
8788
":chapi-parser-toml",

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ dependencies {
184184
jacocoAggregation(project(":chapi-ast-scala"))
185185
jacocoAggregation(project(":chapi-ast-cpp"))
186186
jacocoAggregation(project(":chapi-ast-protobuf"))
187+
jacocoAggregation(project(":chapi-ast-swift"))
187188

188189
jacocoAggregation(project(":chapi-parser-toml"))
189190
jacocoAggregation(project(":chapi-parser-cmake"))

chapi-ast-swift/build.gradle.kts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
plugins {
2+
id("antlr")
3+
java
4+
kotlin("jvm")
5+
kotlin("plugin.serialization") version "1.9.24"
6+
7+
`jacoco-conventions`
8+
}
9+
10+
repositories {
11+
mavenCentral()
12+
mavenLocal()
13+
}
14+
15+
dependencies {
16+
antlr("org.antlr:antlr4:4.13.2")
17+
18+
// project deps
19+
implementation(project(":chapi-domain"))
20+
21+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
22+
23+
implementation(kotlin("stdlib-jdk8"))
24+
implementation(kotlin("reflect"))
25+
testImplementation(kotlin("test"))
26+
27+
// JUnit 5
28+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
29+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.2")
30+
testRuntimeOnly("org.junit.platform:junit-platform-console:1.10.2")
31+
32+
implementation("org.antlr:antlr4:4.13.2")
33+
implementation("org.antlr:antlr4-runtime:4.13.2")
34+
}
35+
36+
sourceSets.main {
37+
java.srcDirs("${project.layout.buildDirectory.get().asFile}/generated-src")
38+
}
39+
40+
tasks.generateGrammarSource {
41+
maxHeapSize = "256m"
42+
arguments = arguments + listOf("-package", "chapi.ast.antlr") + listOf("-visitor", "-long-messages")
43+
outputDirectory = file("${project.layout.buildDirectory.get().asFile}/generated-src/chapi/ast/antlr")
44+
}
45+
46+
tasks.named("compileKotlin") {
47+
dependsOn(tasks.withType<AntlrTask>())
48+
}
49+
50+
tasks.withType<Test> {
51+
useJUnitPlatform()
52+
testLogging {
53+
events("passed", "skipped", "failed")
54+
}
55+
}
56+

0 commit comments

Comments
 (0)