Update to cpp jsonnet

This commit is contained in:
Dave Cunningham 2018-03-16 17:55:13 -04:00
parent 6efde9677d
commit 0b46b25f0f
4 changed files with 9612 additions and 7916 deletions

File diff suppressed because it is too large Load Diff

@ -1 +1 @@
Subproject commit 0759409780eec8cb3a7a8ced52f104c0d895ac38
Subproject commit 8b115c435efa273f45711534b361e847f25f94a7

View File

@ -86,7 +86,6 @@ func (s *dumpState) dumpSlice(v reflect.Value) {
numEntries := v.Len()
if numEntries == 0 {
s.w.Write([]byte("{}"))
s.newline()
return
}
s.w.Write([]byte("{"))

View File

@ -898,7 +898,7 @@ limitations under the License.
aux(value, [], ''),
manifestYamlDoc(value)::
local aux(v, in_array, in_object, path, cindent) =
local aux(v, in_object, path, cindent) =
if v == true then
'true'
else if v == false then
@ -923,21 +923,21 @@ limitations under the License.
'[]'
else
local range = std.range(0, std.length(v) - 1);
local new_indent = cindent + ' ';
local parts = [aux(v[i], true, false, path + [i], new_indent) for i in range];
(if in_object then '\n' + cindent else '') + '- ' + std.join('\n' + cindent + '- ', parts)
local actual_indent = if in_object then cindent[2:] else cindent;
local parts = [aux(v[i], false, path + [i], cindent) for i in range];
(if in_object then '\n' + actual_indent else '')
+ '- ' + std.join('\n' + actual_indent + '- ', parts)
else if std.type(v) == 'object' then
if std.length(v) == 0 then
'{}'
else
local new_indent = cindent + ' ';
local lines = [
cindent + std.escapeStringJson(k) + ': ' + aux(v[k], false, true, path + [k], new_indent)
std.escapeStringJson(k) + ': ' + aux(v[k], true, path + [k], new_indent)
for k in std.objectFields(v)
];
(if in_array || in_object then '\n' else '')
+ std.join('\n', lines);
aux(value, false, false, [], ''),
(if in_object then '\n' + cindent else '') + std.join('\n' + cindent, lines);
aux(value, false, [], ''),
manifestYamlStream(value)::
if std.type(value) != 'array' then