示例#1
0
 def __init__(self, m, name, sinfo):
     m.stmt("/* structure")
     cm = GoModule()
     m.stmt(cm)
     cm.stmt(name)
     self.cm_map = {sinfo["jsonname"]: cm}
     m.stmt("*/")
示例#2
0
from prestring.go import GoModule

m = GoModule()
with m.import_group() as im:
    im("fmt")

with m.func("main"):
    m.stmt('fmt.Println("Hello, 世界")')
print(m)
示例#3
0
from prestring import PreString
from prestring.go import GoModule

m = GoModule()
p = PreString("")
m.stmt("foo")
m.stmt(p)
m.stmt("bar")

p.body.append("*inner*")

print(m)