Skip to content

Commit

Permalink
Merge pull request #6 from ChAoSUnItY/master
Browse files Browse the repository at this point in the history
More implmentation
  • Loading branch information
ChAoSUnItY authored Dec 16, 2022
2 parents d76de60 + 034d7aa commit 49bc4a1
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 27 deletions.
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
id("maven-publish")
id("java")
id("com.github.johnrengelman.shadow") version "7.1.2"
}

val commonVersion: String by properties

group = "chaos.unity.nenggao"
version = "1.4.0"
version = commonVersion

repositories {
mavenCentral()
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
commonVersion=1.4.1
4 changes: 3 additions & 1 deletion kotlinImpl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ plugins {
kotlin("jvm") version "1.7.20"
}

val commonVersion: String by project(":").properties

group = "chaos.unity.nenggao"
version = "1.4.0"
version = commonVersion

repositories {
mavenCentral()
Expand Down
7 changes: 7 additions & 0 deletions kotlinImpl/src/main/kotlin/chaos/unity/nengao/KtLabel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package chaos.unity.nengao

import chaos.unity.nenggao.AbstractLabel
import chaos.unity.nenggao.AbstractSpan

@Suppress("unused")
data class KtLabel(val span: AbstractSpan, val message: String) : AbstractLabel(span, message)
6 changes: 6 additions & 0 deletions kotlinImpl/src/main/kotlin/chaos/unity/nengao/KtPosition.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package chaos.unity.nengao

import chaos.unity.nenggao.AbstractPosition

@Suppress("unused")
data class KtPosition(val line: Int, val pos: Int) : AbstractPosition(line, pos)
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package chaos.unity.nengao.kotlin
package chaos.unity.nengao

import chaos.unity.nenggao.AbstractPosition
import chaos.unity.nenggao.AbstractSpan
import chaos.unity.nenggao.Span

data class Span(val startPosition: AbstractPosition, val endPosition: AbstractPosition) :
@Suppress("unused")
data class KtSpan(val startPosition: AbstractPosition, val endPosition: AbstractPosition) :
AbstractSpan(startPosition, endPosition) {
override fun expand(endSpan: AbstractSpan?): AbstractSpan =
endSpan?.let {
Expand Down
6 changes: 0 additions & 6 deletions kotlinImpl/src/main/kotlin/chaos/unity/nengao/kotlin/Label.kt

This file was deleted.

This file was deleted.

16 changes: 16 additions & 0 deletions scalaImpl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
scala
}

val commonVersion: String by properties

group = "chaos.unity.nenggao"
version = commonVersion

repositories {
mavenCentral()
}

dependencies {
implementation(project(":"))
}
6 changes: 6 additions & 0 deletions scalaImpl/src/main/scala/chaos/unity/nenggao/ScLabel.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package chaos.unity.nenggao

import scala.annotation.unused

@unused
case class ScLabel(span: AbstractSpan, message: String) extends AbstractLabel(span, message)
6 changes: 6 additions & 0 deletions scalaImpl/src/main/scala/chaos/unity/nenggao/ScPosition.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package chaos.unity.nenggao

import scala.annotation.unused

@unused
case class ScPosition(line: Int, pos: Int) extends AbstractPosition(line, pos)
20 changes: 20 additions & 0 deletions scalaImpl/src/main/scala/chaos/unity/nenggao/ScSpan.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package chaos.unity.nenggao

case class ScSpan(startPosition: AbstractPosition, endPosition: AbstractPosition) extends AbstractSpan(startPosition, endPosition) {
override def expand(endSpan: AbstractSpan): AbstractSpan = {
val copied = copy()

if (endSpan == null) copied
else if (endSpan.endPosition.line < startPosition.line) copied
else if (endSpan.endPosition.line == startPosition.line && endSpan.endPosition.pos < startPosition.pos) copied
else {
val startPosition = startPosition
val endPosition = endSpan.endPosition

ScSpan(startPosition, endPosition)
}
}

override def copy(): AbstractSpan =
ScSpan(startPosition, endPosition)
}
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
rootProject.name = "Nenggao"

include("kotlinImpl")
include("scalaImpl")
10 changes: 0 additions & 10 deletions src/test/resources/long_line.yk
Original file line number Diff line number Diff line change
@@ -1,10 +0,0 @@
start
post-start






pre-end
end

0 comments on commit 49bc4a1

Please sign in to comment.