Skip to content
Merged
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
6 changes: 3 additions & 3 deletions build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ object sjsonnet extends VersionFileModule {

def mvnDeps = super.mvnDeps() ++
Seq(
mvn"org.virtuslab::scala-yaml::0.3.0"
mvn"org.virtuslab::scala-yaml::0.3.1"
)

def nodeJsArgs: List[String] = List("--stack-size=" + stackSizekBytes)
Expand Down Expand Up @@ -265,7 +265,7 @@ object sjsonnet extends VersionFileModule {
def mvnDeps = super.mvnDeps() ++
Seq(
mvn"com.github.lolgab::scala-native-crypto::0.3.0",
mvn"org.virtuslab::scala-yaml::0.3.0"
mvn"org.virtuslab::scala-yaml::0.3.1"
)

def releaseMode = ReleaseMode.ReleaseFull
Expand Down Expand Up @@ -301,7 +301,7 @@ object sjsonnet extends VersionFileModule {
def mvnDeps = super.mvnDeps() ++ Seq(
mvn"org.tukaani:xz::1.11",
mvn"at.yawk.lz4:lz4-java::1.10.3",
mvn"org.yaml:snakeyaml::2.4",
mvn"org.yaml:snakeyaml::2.6",
mvn"com.google.re2j:re2j:1.8"
)

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ lazy val main = (project in file("sjsonnet"))
"at.yawk.lz4" % "lz4-java" % "1.10.3",
"org.scala-lang.modules" %% "scala-collection-compat" % "2.14.0",
"org.tukaani" % "xz" % "1.11",
"org.yaml" % "snakeyaml" % "2.5",
"org.yaml" % "snakeyaml" % "2.6",
"com.google.re2j" % "re2j" % "1.8"
),
libraryDependencies ++= Seq(
Expand Down
76 changes: 55 additions & 21 deletions sjsonnet/src-js/sjsonnet/Platform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,69 @@ object Platform {
Error.fail("Unsupported YAML node type: " + node.getClass.getSimpleName)
}

private val docSplitPattern = Pattern.compile("(^|\n)---\\s*(\n|$)")

def yamlToJson(s: String): ujson.Value = {
val docs = docSplitPattern.split(s, -1)
docs.size match {
// Split YAML multi-document stream manually, similar to SnakeYAML's loadAll
// since parseManyYamls doesn't handle all cases correctly
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

val documents = splitYamlDocuments(s)

documents.size match {
case 0 => ujson.Null
case 1 =>
docs.head.asNode match {
case Right(n) =>
nodeToJson(n)
case Left(e) if docs.head.trim.isEmpty =>
ujson.Null
case Left(e) =>
Error.fail("Error converting YAML to JSON: " + e.getMessage)
}
case 1 => parseSingleDocument(documents.head)
case _ =>
val buf = new mutable.ArrayBuffer[ujson.Value](docs.size)
for (doc <- docs) {
doc.asNode match {
case Right(n) => buf += nodeToJson(n)
case Left(e) if docs.head.trim.isEmpty =>
case Left(e) =>
Error.fail("Error converting YAML to JSON: " + e.getMessage)
}
val buf = new mutable.ArrayBuffer[ujson.Value](documents.size)
for (doc <- documents) {
buf += parseSingleDocument(doc)
}
ujson.Arr(buf)
}
}

private def splitYamlDocuments(s: String): List[String] = {
if (s.trim.isEmpty) return Nil

// Split on document separator "---" at line start
// But only if it's followed by whitespace or end of line
val lines = s.split("\n", -1).toList
val documents = mutable.ArrayBuffer[String]()
val currentDoc = mutable.ArrayBuffer[String]()
var isFirstDoc = true

for (line <- lines) {
val trimmed = line.trim
// Check if this line starts with "---" and is followed by whitespace or end
if (trimmed.startsWith("---") && (trimmed.length == 3 || trimmed.charAt(3).isWhitespace)) {
// Save previous document if not empty
if (currentDoc.nonEmpty || !isFirstDoc) {
documents += currentDoc.mkString("\n")
}
currentDoc.clear()
isFirstDoc = false
} else {
currentDoc += line
}
}

// Add last document
if (currentDoc.nonEmpty || documents.nonEmpty) {
documents += currentDoc.mkString("\n")
}

documents.toList
}

private def parseSingleDocument(doc: String): ujson.Value = {
val trimmed = doc.trim
if (trimmed.isEmpty) {
ujson.Null
} else {
// Use parseYaml for single document
parseYaml(trimmed) match {
case Right(node) => nodeToJson(node)
case Left(e) => Error.fail("Error converting YAML to JSON: " + e.getMessage)
}
}
}

def md5(s: String): String = {
throw new Exception("MD5 not implemented in Scala.js")
}
Expand Down
76 changes: 55 additions & 21 deletions sjsonnet/src-native/sjsonnet/Platform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,35 +77,69 @@ object Platform {
Error.fail("Unsupported YAML node type: " + node.getClass.getSimpleName)
}

private val docSplitPattern = Pattern.compile("(?m)^---\\s*$")

def yamlToJson(s: String): ujson.Value = {
val docs = docSplitPattern.split(s, -1)
docs.length match {
// Split YAML multi-document stream manually, similar to SnakeYAML's loadAll
// since parseManyYamls doesn't handle all cases correctly
val documents = splitYamlDocuments(s)

documents.size match {
case 0 => ujson.Null
case 1 =>
docs.head.asNode match {
case Right(n) =>
nodeToJson(n)
case Left(e) if docs.head.trim.isEmpty =>
ujson.Null
case Left(e) =>
Error.fail("Error converting YAML to JSON: " + e.getMessage)
}
case 1 => parseSingleDocument(documents.head)
case _ =>
val buf = new mutable.ArrayBuffer[ujson.Value](docs.length)
for (doc <- docs) {
doc.asNode match {
case Right(n) => buf += nodeToJson(n)
case Left(e) if doc.isEmpty =>
case Left(e) =>
Error.fail("Error converting YAML to JSON: " + e.getMessage)
}
val buf = new mutable.ArrayBuffer[ujson.Value](documents.size)
for (doc <- documents) {
buf += parseSingleDocument(doc)
}
ujson.Arr(buf)
}
}

private def splitYamlDocuments(s: String): List[String] = {
if (s.trim.isEmpty) return Nil

// Split on document separator "---" at line start
// But only if it's followed by whitespace or end of line
val lines = s.split("\n", -1).toList
val documents = mutable.ArrayBuffer[String]()
val currentDoc = mutable.ArrayBuffer[String]()
var isFirstDoc = true

for (line <- lines) {
val trimmed = line.trim
// Check if this line starts with "---" and is followed by whitespace or end
if (trimmed.startsWith("---") && (trimmed.length == 3 || trimmed.charAt(3).isWhitespace)) {
// Save previous document if not empty
if (currentDoc.nonEmpty || !isFirstDoc) {
documents += currentDoc.mkString("\n")
}
currentDoc.clear()
isFirstDoc = false
} else {
currentDoc += line
}
}

// Add last document
if (currentDoc.nonEmpty || documents.nonEmpty) {
documents += currentDoc.mkString("\n")
}

documents.toList
}

private def parseSingleDocument(doc: String): ujson.Value = {
val trimmed = doc.trim
if (trimmed.isEmpty) {
ujson.Null
} else {
// Use parseYaml for single document
parseYaml(trimmed) match {
case Right(node) => nodeToJson(node)
case Left(e) => Error.fail("Error converting YAML to JSON: " + e.getMessage)
}
}
}

private def computeHash(algorithm: String, s: String) = {
java.security.MessageDigest
.getInstance(algorithm)
Expand Down
2 changes: 2 additions & 0 deletions sjsonnet/src/sjsonnet/Importer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ class CachedResolver(
case e: ParseError if e.offset >= 0 =>
val pos = new Position(new FileScope(path), e.offset)
Left(new ParseError(e.getMessage).addFrame(pos))
case e: ParseError =>
Left(e)
}
parsed.flatMap { case (e, fs) => process(e, fs) }
}
Expand Down
3 changes: 3 additions & 0 deletions sjsonnet/test/resources/go_test_suite/.sync_ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Files to ignore when syncing from google/go-jsonnet (Go test suite).
# One .jsonnet filename per line. Lines starting with '#' are comments.
# Corresponding .golden files are also automatically ignored.
7 changes: 7 additions & 0 deletions sjsonnet/test/resources/test_suite/.sync_ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Files to ignore when syncing from google/jsonnet (C++ test suite).
# One .jsonnet filename per line. Lines starting with '#' are comments.
# Corresponding .golden files are also automatically ignored.
#
# error.std_parseYaml1.jsonnet: sjsonnet uses SnakeYAML/scala-yaml which
# successfully parses 'a: b:' as {"a":"b:"}, unlike RapidYAML which errors.
error.std_parseYaml1.jsonnet
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[[[[[[[[[[[[[[[[[[[[[[[[[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]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sjsonnet.ParseError: Parsing exceeded maximum recursion depth of 1000
2 changes: 2 additions & 0 deletions sjsonnet/test/resources/test_suite/stdlib.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,8 @@ std.assertEqual(std.parseJson('{"a": {"b": ["c", 42]}}'), { a: { b: ['c', 42] }
// Empty input evaluates to `null`.
// Regression test for https://github.com/google/jsonnet/issues/1270
std.assertEqual(std.parseYaml(' \n'), null) &&
// Stream input, regression test for https://github.com/google/jsonnet/issues/1148
std.assertEqual(std.parseYaml('1\n---'), [1, null]) &&
std.assertEqual(std.parseYaml('{}'), {}) &&
std.assertEqual(std.parseYaml('[]'), []) &&
std.assertEqual(
Expand Down
Loading
Loading