Skip to content

Commit

Permalink
Remove stub of support for Clojure (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg authored Jan 10, 2024
2 parents a40c8b0 + b69ee41 commit 4e0b90d
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ enum class Language {
JAVA_PRE15,
KOTLIN,
GROOVY,
SCALA,
CLOJURE;
SCALA;

companion object {
fun fromFilename(filename: String): Language {
Expand All @@ -37,8 +36,6 @@ enum class Language {
"gy" -> GROOVY
"scala",
"sc" -> SCALA
"clj",
"cljs" -> CLOJURE
else -> throw IllegalArgumentException("Unknown language for file $filename")
}
}
Expand Down Expand Up @@ -88,10 +85,8 @@ internal object LiteralInt : LiteralFormat<Int>() {

internal object LiteralLong : LiteralFormat<Long>() {
override fun encode(value: Long, language: Language): String {
val buffer = encodeUnderscores(StringBuilder(), value.toLong(), language)
if (language != Language.CLOJURE) {
buffer.append('L')
}
val buffer = encodeUnderscores(StringBuilder(), value, language)
buffer.append('L')
return buffer.toString()
}
override fun parse(str: String, language: Language): Long {
Expand All @@ -107,12 +102,18 @@ private const val TRIPLE_QUOTE = "\"\"\""

internal object LiteralString : LiteralFormat<String>() {
override fun encode(value: String, language: Language): String =
if (value.indexOf('\n') == -1) singleLineJavaToSource(value)
if (value.indexOf('\n') == -1)
when (language) {
Language.JAVA_PRE15,
Language.JAVA -> singleLineJavaToSource(value)
Language.GROOVY,
Language.SCALA,
Language.KOTLIN -> singleLineJavaToSource(value)
}
else
when (language) {
Language.GROOVY,
Language.SCALA,
Language.CLOJURE,
Language.JAVA_PRE15 -> singleLineJavaToSource(value)
Language.JAVA -> multiLineJavaToSource(value)
Language.KOTLIN -> multiLineJavaToSource(value)
Expand Down

0 comments on commit 4e0b90d

Please sign in to comment.