Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomassetti committed Jan 17, 2025
1 parent 325f97d commit d2fa859
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 29 deletions.
37 changes: 19 additions & 18 deletions ast/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinMultiplatform
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
kotlin("multiplatform")
Expand Down Expand Up @@ -52,20 +52,21 @@ publishing {
// kotlinMultiplatform = true)
}


mavenPublishing {
configure(KotlinMultiplatform(
// configures the -javadoc artifact, possible values:
// - `JavadocJar.None()` don't publish this artifact
// - `JavadocJar.Empty()` publish an emprt jar
// - `JavadocJar.Dokka("dokkaHtml")` when using Kotlin with Dokka, where `dokkaHtml` is the name of the Dokka task that should be used as input
javadocJar = JavadocJar.Dokka("dokkaHtml"),
// whether to publish a sources jar
sourcesJar = true,
// configure which Android library variants to publish if this project has an Android target
// defaults to "release" when using the main plugin and nothing for the base plugin
//androidVariantsToPublish = listOf("debug", "release"),
))
configure(
KotlinMultiplatform(
// configures the -javadoc artifact, possible values:
// - `JavadocJar.None()` don't publish this artifact
// - `JavadocJar.Empty()` publish an emprt jar
// - `JavadocJar.Dokka("dokkaHtml")` when using Kotlin with Dokka, where `dokkaHtml` is the name of the Dokka task that should be used as input
javadocJar = JavadocJar.Dokka("dokkaHtml"),
// whether to publish a sources jar
sourcesJar = true,
// configure which Android library variants to publish if this project has an Android target
// defaults to "release" when using the main plugin and nothing for the base plugin
// androidVariantsToPublish = listOf("debug", "release"),
),
)
coordinates(project.group as String, "kolasu-ast", project.version as String)

pom {
Expand Down Expand Up @@ -104,9 +105,9 @@ mavenPublishing {
}
}

//signing {
//// sign(publishing.publications["kolasu_ast"])
//}
// signing {
// // sign(publishing.publications["kolasu_ast"])
// }

signing {
sign(publishing.publications)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@ object BaseStarLasuLanguage : StarLasuLanguage("com.strumenta.basestarlasulangua
types.add(commonElement)

setOf(
Expression::class, Statement::class, EntityDeclaration::class, BehaviorDeclaration::class,
Parameter::class, Documentation::class, EntityGroupDeclaration::class, TypeAnnotation::class
Expression::class,
Statement::class,
EntityDeclaration::class,
BehaviorDeclaration::class,
Parameter::class,
Documentation::class,
EntityGroupDeclaration::class,
TypeAnnotation::class,
).forEach { kClass ->
val aCommonElement = ConceptInterface(this, CommonElement::class.simpleName!!)
aCommonElement.superInterfaces.add(commonElement)
types.add(aCommonElement)
}

}

val astNode: Concept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ open class StarLasuLanguage(
stringType
} else {
this.types.filterIsInstance<DataType>().find { it.name == name }
?: throw IllegalArgumentException("Cannot find data type $name. Known types are ${
this.types.filterIsInstance<DataType>().joinToString(", ") { it.name }
}")
?: throw IllegalArgumentException(
"Cannot find data type $name. Known types are ${
this.types.filterIsInstance<DataType>().joinToString(", ") { it.name }
}",
)
}

fun getEnum(name: String) : EnumType {
return getDataType(name) as? EnumType ?: throw IllegalArgumentException("Does not correspond to enum: $name")
}
fun getEnum(name: String): EnumType =
getDataType(name) as? EnumType ?: throw IllegalArgumentException("Does not correspond to enum: $name")

fun getPrimitiveType(name: String): PrimitiveType =
this.types.filterIsInstance<PrimitiveType>().find {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ data class PrimitiveType(
}
}


data class EnumType(
override val name: String,
val literals: MutableList<EnumerationLiteral> = mutableListOf(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import kotlin.reflect.KClass
*/
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS)
annotation class KolasuGen(val language: KClass<out StarLasuLanguage> = PlaceholderLanguage::class)
annotation class KolasuGen(
val language: KClass<out StarLasuLanguage> = PlaceholderLanguage::class,
)

object PlaceholderLanguage : StarLasuLanguage("dummy")

0 comments on commit d2fa859

Please sign in to comment.