Skip to content

Commit

Permalink
[builtin/pp] Use j8 printer instead of yajl
Browse files Browse the repository at this point in the history
The spec tests pass!  The j8 printer still uses QSN strings inside "",
but that's good enough for these tests.  I believe they should now pass
in C++.
  • Loading branch information
Andy C committed Dec 23, 2023
1 parent a77d88c commit afc8d69
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion builtin/io_ysh.py
Expand Up @@ -54,6 +54,7 @@ def __init__(self, mem, errfmt, procs, arena):
self.procs = procs
self.arena = arena
self.stdout_ = mylib.Stdout()
self.printer = j8.Printer(0)

def Run(self, cmd_val):
# type: (cmd_value.Argv) -> int
Expand Down Expand Up @@ -121,12 +122,18 @@ def Run(self, cmd_val):

ysh_type = ui.ValType(val)
self.stdout_.write('(%s) ' % ysh_type)
if mylib.PYTHON:
#if mylib.PYTHON:
if 0:
obj = cpython._ValueToPyObj(val)
j = yajl.dumps(obj, indent=-1)
self.stdout_.write(j)
self.stdout_.write('\n')

buf = mylib.BufWriter()
self.printer.Print(val, buf, indent=-1)
self.stdout_.write(buf.getvalue())
self.stdout_.write('\n')

status = 0

elif action == 'gc-stats':
Expand Down

0 comments on commit afc8d69

Please sign in to comment.