Skip to content
Open
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
12 changes: 9 additions & 3 deletions sjsonnet/src/sjsonnet/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,17 @@ class Parser(
else if (pos + indentLen <= dataLen && data.regionMatches(pos, indent, 0, indentLen)) {
val afterIndent = pos + indentLen
// Find line end (next separator char)
var lineEnd = afterIndent
while (lineEnd < dataLen && sep.indexOf(data.charAt(lineEnd)) < 0) lineEnd += 1
val lineEnd =
if (sepLen == 1) data.indexOf(sep.charAt(0), afterIndent)
else {
var i = afterIndent
while (i < dataLen && sep.indexOf(data.charAt(i)) < 0) i += 1
i
}
// Verify full separator at lineEnd
if (
lineEnd + sepLen <= dataLen && data.charAt(lineEnd) == sep.charAt(0) &&
lineEnd >= 0 && lineEnd + sepLen <= dataLen &&
data.charAt(lineEnd) == sep.charAt(0) &&
(sepLen == 1 || data.charAt(lineEnd + 1) == sep.charAt(1))
) {
// Zero-copy bulk append: extra whitespace + content + separator (skipping indent)
Expand Down
Loading