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
10 changes: 5 additions & 5 deletions sjsonnet/src/sjsonnet/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ class Parser(
SingleChar./.flatMapX {
case '\"' => literalDoubleString
case '\'' => literalSingleString
case _ => Fail
case _ => Fail.opaque("verbatim string literal (@\" or @')")
}
case '|' => maybeChompedTripleBarString
case _ => Fail
case _ => Fail.opaque("string literal")
}
).map(_.mkString)

Expand Down Expand Up @@ -693,7 +693,7 @@ class Parser(
}
case '{' =>
Pass ~ (objinside(i, currentDepth + 1) ~ "}").map(x => Expr.ObjExtend(i, _: Expr, x))
case _ => Fail
case _ => Fail.opaque("expression")
}
}
)
Expand Down Expand Up @@ -792,7 +792,7 @@ class Parser(
SingleChar./.flatMapX {
case '\"' => literalDoubleString.map(constructString(pos, _))
case '\'' => literalSingleString.map(constructString(pos, _))
case _ => Fail
case _ => Fail.opaque("verbatim string literal (@\" or @')")
}
case '|' => maybeChompedTripleBarString.map(constructString(pos, _))
case '$' => Pass(Expr.$(pos))
Expand All @@ -817,7 +817,7 @@ class Parser(
case x => Pass(Expr.Id(pos, x))
}
}
else Fail
else Fail.opaque("expression")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sjsonnet.ParseError: Expected fail:1:2, found ""
sjsonnet.ParseError: Expected expression:1:2, found ""
at [std.extVar].(<ext-var staticErrorVar> offset:1)
at [<root>].(extvar_static_error.jsonnet:1:11)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// %c format conversion must reject empty strings, matching C++/go-jsonnet behavior.
// C++ jsonnet: RUNTIME ERROR: %c expected 1-sized string got: 0
// go-jsonnet: RUNTIME ERROR: %c expected 1-sized string got: 0
// jrsonnet: runtime error: %c expected 1 char string, got 0
"%c" % ""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
""
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// %c format conversion must reject multi-character strings, matching C++/go-jsonnet behavior.
// C++ jsonnet: RUNTIME ERROR: %c expected 1-sized string got: 2
// go-jsonnet: RUNTIME ERROR: %c expected 1-sized string got: 2
// jrsonnet: runtime error: %c expected 1 char string, got 2
"%c" % "AB"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"AB"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sjsonnet.ParseError: Expected fail:17:2, found "5\n"
sjsonnet.ParseError: Expected expression:17:2, found "5\n"
at [<root>].(error.parse.static_error_bad_number.jsonnet:17:2)

Loading