Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin 1.9.0 support and usage of Kotlin Common Regex implementation #67

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ kotlin {

jvm {
compilations["main"].apply {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "17"
}

compilations["test"].defaultSourceSet.dependencies {
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ kotlin {
implementation(kotlin("test-junit"))
}
compilations.all {
kotlinOptions.jvmTarget = "1.6"
kotlinOptions.jvmTarget = "17"
}
}

js(BOTH) {
js(IR) {
browser()
nodejs()

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
// TODO: setup the version in the same way as in the root project once IJ fixes importing of buildSrc
kotlin("jvm").version("1.4.21")
kotlin("jvm").version("1.9.0")
}

repositories {
Expand Down
6 changes: 4 additions & 2 deletions demo/demo-js/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ dependencies {
implementation(rootProject)
}

kotlin.js().nodejs()
kotlin.js("IR") {
browser()
binaries.executable()
}

var assembleWeb = task<Sync>("assembleWeb") {
val main by kotlin.js().compilations.getting
Expand All @@ -20,7 +23,6 @@ var assembleWeb = task<Sync>("assembleWeb") {
}
})

from(main.compileKotlinTaskProvider.map { it.destinationDir })
from(kotlin.sourceSets.main.get().resources) { include("*.html") }
into("${buildDir}/web")
}
Expand Down
2 changes: 1 addition & 1 deletion demo/demo-js/src/main/resources/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<h3>Boolean expression parser</h3>

<label for="expr"></label><input id="expr" value="toBe | !toBe"/>
<label for="expr"></label><input id="expr" value="a & (b1 -> c1) | a1 & !b | !(a1 -> a2) -> a"/>

<button id="parse">Parse</button>

Expand Down
2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
group=com.github.h0tk3y.betterParse

kotlin.code.style=official

kotlin.mpp.enableCompatibilityMetadataVariant=true
kotlin.mpp.stability.nowarn=true

# Workaround for Bintray treating .sha512 files as artifacts
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2,807 changes: 2,807 additions & 0 deletions kotlin-js-store/yarn.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package com.github.h0tk3y.betterParse.lexer

public expect class RegexToken : Token {
public constructor(name: String?, @Language("RegExp", "", "") patternString: String, ignored: Boolean = false)
public constructor(name: String?, regex: Regex, ignored: Boolean = false)

public class RegexToken(name: String?, private val pattern: Regex, ignored: Boolean = false) : Token(name = name, ignored = ignored) {

public constructor(name: String?, pattern: String, ignored: Boolean = false): this(name, pattern.toRegex(), ignored)
override fun match(input: CharSequence, fromIndex: Int): Int {
val result = this.pattern.matchAt(input, fromIndex)
return result?.range?.count() ?: 0
}
}

public fun regexToken(name: String, @Language("RegExp", "", "") pattern: String, ignore: Boolean = false): RegexToken =
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 6 additions & 6 deletions versions.settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ package com.github.h0tk3y.betterParse.build
import org.gradle.api.plugins.ExtraPropertiesExtension
import kotlin.reflect.full.memberProperties

val kotlinVersion = KotlinPlugin.V1620
val kotlinVersion = KotlinPlugin.V1900

enum class KotlinPlugin {
V1620
V1900
}

val versions = when (kotlinVersion) {
KotlinPlugin.V1620 -> Versions(
KotlinPlugin.V1900 -> Versions(
version = "0.4.4",
kotlinVersion = "1.6.20",
serializationVersion = "1.3.2",
benchmarkVersion = "0.4.2"
kotlinVersion = "1.9.0",
serializationVersion = "1.5.1",
benchmarkVersion = "0.4.9"
)
}

Expand Down