Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Seggan committed Mar 19, 2022
1 parent 681072b commit e20466c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 38 deletions.
51 changes: 24 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import java.util.jar.JarInputStream
import java.util.regex.Pattern

plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'antlr'
id 'org.jetbrains.kotlin.jvm' version '1.6.20-RC'
id "java"
id "application"
id "com.github.johnrengelman.shadow" version "7.1.2"
id "antlr"
id "org.jetbrains.kotlin.jvm" version "1.6.20-RC"
}

group 'io.github.seggan.jyxal'
version '0.4.0'
group "io.github.seggan.jyxal"
version "0.4.0"

mainClassName = 'io.github.seggan.jyxal.Main'
mainClassName = "io.github.seggan.jyxal.Main"

JPath dest = JPath.of("$buildDir/runtime-classes/")

Expand All @@ -29,22 +29,22 @@ configurations {
}

dependencies {
implementation 'org.ow2.asm:asm:9.2'
implementation 'org.ow2.asm:asm-commons:9.2'
implementation 'org.ow2.asm:asm-util:9.2'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20-RC'
implementation 'com.guardsquare:proguard-base:7.2.1'
runtimeLib('org.jetbrains.kotlin:kotlin-stdlib:1.6.20-RC') {
implementation "org.ow2.asm:asm:9.2"
implementation "org.ow2.asm:asm-commons:9.2"
implementation "org.ow2.asm:asm-util:9.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20-RC"
implementation "com.guardsquare:proguard-base:7.2.1"
runtimeLib("org.jetbrains.kotlin:kotlin-stdlib:1.6.20-RC") {
transitive = false
}
runtimeLib('org.jetbrains:annotations:23.0.0') {
runtimeLib("org.jetbrains:annotations:23.0.0") {
transitive = false
}
antlr 'org.antlr:antlr4:4.9.3'
antlr "org.antlr:antlr4:4.9.3"

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.2"
testImplementation "org.jetbrains.kotlin:kotlin-reflect:1.6.10"
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.8.2"
}

test {
Expand All @@ -66,23 +66,20 @@ generateGrammarSource {
.forEach(Files::delete)
Files.createDirectories(fullPath)
}
arguments += ["-lib", fullPath.toAbsolutePath().toString(), '-visitor', '-no-listener', "-encoding", "UTF-8"]
arguments += ["-lib", fullPath.toAbsolutePath().toString(), "-visitor", "-no-listener", "-encoding", "UTF-8"]
}

compileJava {
dependsOn generateGrammarSource

sourceCompatibility = '11'
targetCompatibility = '11'
sourceCompatibility = "11"
targetCompatibility = "11"
}

sourceSets {
main {
java {
srcDir 'src/main/antlr'
}
kotlin {
srcDir 'src/main/kotlin'
srcDir "src/main/antlr"
}
}
generated {
Expand Down Expand Up @@ -131,13 +128,13 @@ task copyRuntime() {
}
Set<String> names = new HashSet<>(Files.readAllLines(list))
String dir = "$buildDir/classes/"
Pattern regex = Pattern.compile("${buildDir.toString().replace('\\', '/')}/classes/(java|kotlin)/main/")
Pattern regex = Pattern.compile("${buildDir.toString().replace("\\", "/")}/classes/(java|kotlin)/main/")
Files.walk(JPath.of(dir))
.filter(Files::isRegularFile)
.filter(f -> f.toString().contains("runtime"))
.filter(f -> f.toString().contains("main"))
.forEach(f -> {
String rel = regex.matcher(f.toString().replace('\\', '/')).replaceAll("")
String rel = regex.matcher(f.toString().replace("\\", "/")).replaceAll("")
JPath d = dest.resolve(rel)
Files.createDirectories(d.getParent())
Files.copy(f, d, StandardCopyOption.REPLACE_EXISTING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import io.github.seggan.jyxal.runtime.ProgramStack
import io.github.seggan.jyxal.runtime.math.BigComplex
import io.github.seggan.jyxal.runtime.plus
import java.math.BigInteger
import java.util.function.Supplier

abstract class JyxalList : Collection<Any> {

Expand Down Expand Up @@ -67,25 +66,21 @@ abstract class JyxalList : Collection<Any> {
})
}

fun createInf(supplier: Supplier<Any>): Any {
return createInf { supplier.get() }
}

fun fromIterableLazy(iterable: Iterable<Any>): JyxalList {
return InfiniteList(iterable.iterator())
}
}

protected fun vyxalListFormat(list: List<Any>): String {
val sb = StringBuilder()
sb.append("\u27E8")
sb.append("")
val it = list.iterator()
while (true) {
if (!it.hasNext()) {
if (sb.length > 1) {
sb.delete(sb.length - 3, sb.length)
}
return sb.append("\u27E9").toString()
return sb.append("").toString()
}
sb.append(it.next())
sb.append(" | ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import java.util.Deque
*/
object Compression {

const val CODEPAGE = "\u03BB\u019B\u00AC\u2227\u27D1\u2228\u27C7\u00F7\u00D7\u00AB\n\u00BB\u00B0\u2022\u00DF\u2020\u20AC\u00BD\u2206\u00F8\u2194\u00A2\u2310\u00E6\u0280\u0281\u027E\u027D\u00DE\u0188\u221E\u00A8 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]`^_abcdefghijklmnopqrstuvwxyz{|}~\u2191\u2193\u2234\u2235\u203A\u2039\u2237\u00A4\u00F0\u2192\u2190\u03B2\u03C4\u0227\u1E03\u010B\u1E0B\u0117\u1E1F\u0121\u1E23\u1E2D\u0140\u1E41\u1E45\u022F\u1E57\u1E59\u1E61\u1E6B\u1E87\u1E8B\u1E8F\u017C\u221A\u27E8\u27E9\u201B\u2080\u2081\u2082\u2083\u2084\u2085\u2086\u2087\u2088\u00B6\u204B\u00A7\u03B5\u00A1\u2211\u00A6\u2248\u00B5\u0226\u1E02\u010A\u1E0A\u0116\u1E1E\u0120\u1E22\u0130\u013F\u1E40\u1E44\u022E\u1E56\u1E58\u1E60\u1E6A\u1E86\u1E8A\u1E8E\u017B\u208C\u208D\u2070\u00B9\u00B2\u2207\u2308\u230A\u00AF\u00B1\u20B4\u2026\u25A1\u21B3\u21B2\u22CF\u22CE\uA60D\uA71D\u2105\u2264\u2265\u2260\u207C\u0192\u0256\u222A\u2229\u228D\u00A3\u00A5\u21E7\u21E9\u01CD\u01CE\u01CF\u01D0\u01D1\u01D2\u01D3\u01D4\u207D\u2021\u226C\u207A\u21B5\u215B\u00BC\u00BE\u03A0\u201E\u201F"
private const val COMPRESSION_CODEPAGE = "\u03BB\u019B\u00AC\u2227\u27D1\u2228\u27C7\u00F7\u00D7\u00AB\u00BB\u00B0\u2022\u00DF\u2020\u20AC\u00BD\u2206\u00F8\u2194\u00A2\u2310\u00E6\u0280\u0281\u027E\u027D\u00DE\u0188\u221E\u00A8\u2191\u2193\u2234\u2235\u203A\u2039\u2237\u00A4\u00F0\u2192\u2190\u03B2\u03C4\u0227\u1E03\u010B\u1E0B\u0117\u1E1F\u0121\u1E23\u1E2D\u0140\u1E41\u1E45\u022F\u1E57\u1E59\u1E61\u1E6B\u1E87\u1E8B\u1E8F\u017C\u221A\u27E8\u27E9\u201B\u2080\u2081\u2082\u2083\u2084\u2085\u2086\u2087\u2088\u00B6\u204B\u00A7\u03B5\u00A1\u2211\u00A6\u2248\u00B5\u0226\u1E02\u010A\u1E0A\u0116\u1E1E\u0120\u1E22\u0130\u013F\u1E40\u1E44\u022E\u1E56\u1E58\u1E60\u1E6A\u1E86\u1E8A\u1E8E\u017B\u208C\u208D\u2070\u00B9\u00B2\u2207\u2308\u230A\u00AF\u00B1\u20B4\u2026\u25A1\u21B3\u21B2\u22CF\u22CE\uA60D\uA71D\u2105\u2264\u2265\u2260\u207C\u0192\u0256\u222A\u2229\u228D\u00A3\u00A5\u21E7\u21E9\u01CD\u01CE\u01CF\u01D0\u01D1\u01D2\u01D3\u01D4\u207D\u2021\u226C\u207A\u21B5\u215B\u00BC\u00BE\u03A0\u201E\u201F"
const val CODEPAGE = "λƛ¬∧⟑∨⟇÷׫\n»°•ß†€½∆ø↔¢⌐æʀʁɾɽÞƈ∞¨ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]`^_abcdefghijklmnopqrstuvwxyz{|}~↑↓∴∵›‹∷¤ð→←βτȧḃċḋėḟġḣḭŀṁṅȯṗṙṡṫẇẋẏż√⟨⟩‛₀₁₂₃₄₅₆₇₈¶⁋§ε¡∑¦≈µȦḂĊḊĖḞĠḢİĿṀṄȮṖṘṠṪẆẊẎŻ₌₍⁰¹²∇⌈⌊¯±₴…□↳↲⋏⋎꘍ꜝ℅≤≥≠⁼ƒɖ∪∩⊍£¥⇧⇩ǍǎǏǐǑǒǓǔ⁽‡≬⁺↵⅛¼¾Π„‟"
private const val COMPRESSION_CODEPAGE = "λƛ¬∧⟑∨⟇÷׫»°•ß†€½∆ø↔¢⌐æʀʁɾɽÞƈ∞¨↑↓∴∵›‹∷¤ð→←βτȧḃċḋėḟġḣḭŀṁṅȯṗṙṡṫẇẋẏż√⟨⟩‛₀₁₂₃₄₅₆₇₈¶⁋§ε¡∑¦≈µȦḂĊḊĖḞĠḢİĿṀṄȮṖṘṠṪẆẊẎŻ₌₍⁰¹²∇⌈⌊¯±₴…□↳↲⋏⋎꘍ꜝ℅≤≥≠⁼ƒɖ∪∩⊍£¥⇧⇩ǍǎǏǐǑǒǓǔ⁽‡≬⁺↵⅛¼¾Π„‟"

private val longDict: Array<String> by lazy {
val s: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import org.junit.jupiter.api.Test
class CompressionTest {
@Test
fun testCompress() {
Assertions.assertEquals("Hello, World!", decompress("\u0188\u1E61, \u019B\u20AC!"))
Assertions.assertEquals("Hello, World!", decompress("ƈṡ, ƛ€!"))
Assertions.assertEquals(
"This is a test String to decompress.",
decompress("\u03BB\u00AB is a \u2228\u1E0A \u00F8\u1E8F to de\u2022\u215B\u27D1\u013F.")
decompress("λ« is a ∨Ḋ øẏ to de•⅛⟑Ŀ.")
)
Assertions.assertEquals("A test string.", decompress("A test string."))
}
Expand Down

0 comments on commit e20466c

Please sign in to comment.