Skip to content

Commit

Permalink
Update to SnakeYAML 2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskorn committed Nov 20, 2019
1 parent 48b0101 commit db80199
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))

implementation(kotlin("stdlib-jdk8"))
implementation(group = "org.snakeyaml", name = "snakeyaml-engine", version = "1.0")
implementation(group = "org.snakeyaml", name = "snakeyaml-engine", version = "2.0")
implementation(group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-runtime", version = "0.14.0")

val spekVersion = "2.0.8"
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/charleskorn/kaml/Yaml.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import kotlinx.serialization.decode
import kotlinx.serialization.encode
import kotlinx.serialization.modules.EmptyModule
import kotlinx.serialization.modules.SerialModule
import org.snakeyaml.engine.v1.api.StreamDataWriter
import org.snakeyaml.engine.v2.api.StreamDataWriter
import java.io.StringWriter

class Yaml(
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/charleskorn/kaml/YamlException.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package com.charleskorn.kaml

import org.snakeyaml.engine.v1.events.Event
import org.snakeyaml.engine.v2.events.Event

open class YamlException(
override val message: String,
Expand Down
14 changes: 7 additions & 7 deletions src/main/kotlin/com/charleskorn/kaml/YamlNodeReader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

package com.charleskorn.kaml

import org.snakeyaml.engine.v1.common.Anchor
import org.snakeyaml.engine.v1.events.AliasEvent
import org.snakeyaml.engine.v1.events.Event
import org.snakeyaml.engine.v1.events.MappingStartEvent
import org.snakeyaml.engine.v1.events.NodeEvent
import org.snakeyaml.engine.v1.events.ScalarEvent
import org.snakeyaml.engine.v1.events.SequenceStartEvent
import org.snakeyaml.engine.v2.common.Anchor
import org.snakeyaml.engine.v2.events.AliasEvent
import org.snakeyaml.engine.v2.events.Event
import org.snakeyaml.engine.v2.events.MappingStartEvent
import org.snakeyaml.engine.v2.events.NodeEvent
import org.snakeyaml.engine.v2.events.ScalarEvent
import org.snakeyaml.engine.v2.events.SequenceStartEvent
import java.util.Optional

class YamlNodeReader(
Expand Down
28 changes: 14 additions & 14 deletions src/main/kotlin/com/charleskorn/kaml/YamlOutput.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@ import kotlinx.serialization.SerializationStrategy
import kotlinx.serialization.StructureKind
import kotlinx.serialization.internal.AbstractPolymorphicSerializer
import kotlinx.serialization.modules.SerialModule
import org.snakeyaml.engine.v1.api.DumpSettingsBuilder
import org.snakeyaml.engine.v1.api.StreamDataWriter
import org.snakeyaml.engine.v1.common.FlowStyle
import org.snakeyaml.engine.v1.common.ScalarStyle
import org.snakeyaml.engine.v1.emitter.Emitter
import org.snakeyaml.engine.v1.events.DocumentStartEvent
import org.snakeyaml.engine.v1.events.ImplicitTuple
import org.snakeyaml.engine.v1.events.MappingEndEvent
import org.snakeyaml.engine.v1.events.MappingStartEvent
import org.snakeyaml.engine.v1.events.ScalarEvent
import org.snakeyaml.engine.v1.events.SequenceEndEvent
import org.snakeyaml.engine.v1.events.SequenceStartEvent
import org.snakeyaml.engine.v1.events.StreamStartEvent
import org.snakeyaml.engine.v2.api.DumpSettings
import org.snakeyaml.engine.v2.api.StreamDataWriter
import org.snakeyaml.engine.v2.common.FlowStyle
import org.snakeyaml.engine.v2.common.ScalarStyle
import org.snakeyaml.engine.v2.emitter.Emitter
import org.snakeyaml.engine.v2.events.DocumentStartEvent
import org.snakeyaml.engine.v2.events.ImplicitTuple
import org.snakeyaml.engine.v2.events.MappingEndEvent
import org.snakeyaml.engine.v2.events.MappingStartEvent
import org.snakeyaml.engine.v2.events.ScalarEvent
import org.snakeyaml.engine.v2.events.SequenceEndEvent
import org.snakeyaml.engine.v2.events.SequenceStartEvent
import org.snakeyaml.engine.v2.events.StreamStartEvent
import java.util.Optional

internal class YamlOutput(
writer: StreamDataWriter,
override val context: SerialModule,
private val configuration: YamlConfiguration
) : ElementValueEncoder() {
private val settings = DumpSettingsBuilder().build()
private val settings = DumpSettings.builder().build()
private val emitter = Emitter(settings, writer)
private var currentTag: String? = null

Expand Down
12 changes: 6 additions & 6 deletions src/main/kotlin/com/charleskorn/kaml/YamlParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@

package com.charleskorn.kaml

import org.snakeyaml.engine.v1.api.LoadSettingsBuilder
import org.snakeyaml.engine.v1.events.Event
import org.snakeyaml.engine.v1.exceptions.MarkedYamlEngineException
import org.snakeyaml.engine.v1.parser.ParserImpl
import org.snakeyaml.engine.v1.scanner.StreamReader
import org.snakeyaml.engine.v2.api.LoadSettings
import org.snakeyaml.engine.v2.events.Event
import org.snakeyaml.engine.v2.exceptions.MarkedYamlEngineException
import org.snakeyaml.engine.v2.parser.ParserImpl
import org.snakeyaml.engine.v2.scanner.StreamReader
import java.io.StringReader

class YamlParser(yamlSource: String) {
private val dummyFileName = "DUMMY_FILE_NAME"
private val loadSettings = LoadSettingsBuilder().setLabel(dummyFileName).build()
private val loadSettings = LoadSettings.builder().setLabel(dummyFileName).build()
private val streamReader = StreamReader(StringReader(yamlSource), loadSettings)
private val events = ParserImpl(streamReader, loadSettings)

Expand Down

0 comments on commit db80199

Please sign in to comment.