我有一个"深"我要打印的案例类树#34;像Scala"源代码。
...因为我想查看,复制并粘贴它们以制作UnitTest
我正在使用lihaoyi's pprint来执行stringify
的值,但是在几个级别之后,pprint停止打印。
我已经检查了tokenize
的内容,并且实例正在按原样发出;你可以看到字符串没有被删除。
我可以(手动)"调整"我的测试测试部分结果并得到我的漂亮来源,但......感觉不对。
Module(
Set(),
Set(
Material(
"testTextLayoutContainer",
List(
Attribute("Position", VecSingle(2)),
Attribute("UV", VecSingle(2)),
Attribute("Color", VecFixed(4))
),
List(
UniformInstance("ProjMtx", MatSingle(4, 4)),
UniformInstance("Texture", Texture(2, VecFixed(4)))
),
Set(
//
// this is the line that's not being pprinted
//
Program(ImGui,testTextLayoutContainer,Set(Attribute(Color,VecFixed(4)), Attribute(Position,VecSingle(2)), Attribute(UV,VecSingle(2))),Set(UniformInstance(Texture,Texture(2,VecFixed(4))), UniformInstance(ProjMtx,MatSingle(4,4))),Set(VaryingCopy(Attribute(Color,VecFixed(4))), VaryingCopy(Attribute(UV,VecSingle(2)))),List(Lookup(UniformInstance(ProjMtx,MatSingle(4,4))), Lookup(Attribute(Position,VecSingle(2))), Literal(0.0), Literal(1.0), Construct(VecSingle(4),List(Lookup(Attribute(Position,VecSingle(2))), Literal(0.0), Literal(1.0))), External(mat*vec,List(Lookup(UniformInstance(ProjMtx,MatSingle(4,4))), Construct(VecSingle(4),List(Lookup(Attribute(Position,VecSingle(2))), Literal(0.0), Literal(1.0)))),VecSingle(4)), Output(Vertex(ProductTransform(Lookup(UniformInstance(ProjMtx,MatSingle(4,4))),Construct(VecSingle(4),List(Lookup(Attribute(Position,VecSingle(2))), Literal(0.0), Literal(1.0))))),External(mat*vec,List(Lookup(UniformInstance(ProjMtx,MatSingle(4,4))), Construct(VecSingle(4),List(Lookup(Attribute(Position,VecSingle(2))), Literal(0.0), Literal(1.0)))),VecSingle(4))), Lookup(Attribute(Color,VecFixed(4))), Output(VaryingCopy(Attribute(Color,VecFixed(4))),Lookup(Attribute(Color,VecFixed(4)))), Lookup(Attribute(UV,VecSingle(2))), Output(VaryingCopy(Attribute(UV,VecSingle(2))),Lookup(Attribute(UV,VecSingle(2))))),List(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))), Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),x), Lookup(UniformInstance(Texture,Texture(2,VecFixed(4)))), Lookup(VaryingCopy(Attribute(UV,VecSingle(2)))), Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),x), External(*,List(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),x), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),x)),VecFixed(1)), Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),y), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),y), External(*,List(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),y), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),y)),VecFixed(1)), Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),z), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),z), External(*,List(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),z), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),z)),VecFixed(1)), Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),w), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),w), External(*,List(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),w), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),w)),VecFixed(1)), Construct(VecFixed(4),List(External(*,List(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),x), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),x)),VecFixed(1)), External(*,List(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),y), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),y)),VecFixed(1)), External(*,List(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),z), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),z)),VecFixed(1)), External(*,List(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),w), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),w)),VecFixed(1)))), Output(Fragment(Construct(VecFixed(4),List(ProductAtomic(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),x),Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),x)), ProductAtomic(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),y),Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),y)), ProductAtomic(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),z),Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),z)), ProductAtomic(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),w),Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),w))))),Construct(VecFixed(4),List(External(*,List(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),x), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),x)),VecFixed(1)), External(*,List(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),y), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),y)),VecFixed(1)), External(*,List(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),z), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),z)),VecFixed(1)), External(*,List(Access(Lookup(VaryingCopy(Attribute(Color,VecFixed(4)))),w), Access(Sample(UniformInstance(Texture,Texture(2,VecFixed(4))),Lookup(VaryingCopy(Attribute(UV,VecSingle(2))))),w)),VecFixed(1)))))))
)
)
)
)
答案 0 :(得分:1)
您可以提供高度和宽度,因此如果您提供足够大的值,它将显示所有内容。
scala> pprint.pprintln(Seq(1, 2, 3), width = Int.MaxValue, height = Int.MaxValue)
所以
@ pprint.pprintln(1 to 10, 3, 10)
Range.Inclusive(
1,
2...
可以
@ pprint.pprintln(1 to 10, Int.MaxValue, Int.MaxValue)
Range.Inclusive(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
编辑:
正如文档中所提到的,这是一种在打印真正大数据结构时阻止内存错误的功能。
http://www.lihaoyi.com/upickle-pprint/pprint/#GettingStarted