OILS / data_lang / pretty.py View on Github | oilshell.org

40 lines, 19 significant
1#!/usr/bin/env python2
2from __future__ import print_function
3
4from _devbuild.gen.pretty_asdl import doc, doc_t
5from _devbuild.gen.value_asdl import value_e, value_t
6
7from mycpp.mylib import log, tagswitch
8
9_ = log
10
11
12def FromValue(val):
13 # type: (value_t) -> doc_t
14 """Stub to turn an Oils value into a PPL.
15 """
16 with tagswitch(val) as case:
17 # e.g. see data_lang/j8.py
18 # It has options like SHOW_CYCLES and SHOW_NON_DATA
19
20 if case(value_e.Null):
21 return doc.Newline
22
23 elif case(value_e.Bool):
24 return doc.Newline
25
26 elif case(value_e.Int):
27 return doc.Newline
28
29 elif case(value_e.Float):
30 return doc.Newline
31
32 elif case(value_e.Str):
33 return doc.Newline
34
35 else:
36 # TODO: handle more cases
37 return doc.Newline
38
39
40# vim: sw=4