Transformations fail when using pretty printer in Stratego transformations
When calling the pretty printer method pp-LangName-string (from the generated pp.str) the transform fails with stack a trace. This is in a file using embedded syntax in the transform rules. here is an example:
<debug> ("some debug message: ", <pp-Booster2-string> x)
We tried both ctree and jar builds, the issue still occurs. Below is a sample stack trace. Without the call the transformation worked fine.
Submitted by Seyyed Shah on 1 July 2016 at 16:16org.metaborg.core.transform.TransformException: Transformation failed unexpectedly at org.metaborg.spoofax.core.transform.StrategoTransformer.transform(StrategoTransformer.java:136) at org.metaborg.spoofax.core.transform.StrategoTransformer.transform(StrategoTransformer.java:74) at org.metaborg.spoofax.core.transform.StrategoTransformer.transform(StrategoTransformer.java:1) at org.metaborg.core.transform.TransformService.transform(TransformService.java:78) at org.metaborg.spoofax.eclipse.transform.TransformJob.transform(TransformJob.java:132) at org.metaborg.spoofax.eclipse.transform.TransformJob.transformAll(TransformJob.java:108) at org.metaborg.spoofax.eclipse.transform.TransformJob.run(TransformJob.java:70) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by: org.metaborg.core.MetaborgException: Invoking Stratego strategy heuristics-builder failed at term And( Equal( Path( Path(This(){ Def( URI( Language("Booster2") , [ ID(NablNsThis(), This(), Unique("eclipse:///Booster2-examples/petstore.boo2/0")) , ID(NablNsClass(), "LineItem", Unique("eclipse:///Booster2-examples/petstore.boo2/0")) , ID(NablNsSystem(), "PetStore", Unique("eclipse:///Booster2-examples/petstore.boo2/0")) ] ) ) }, PathComponent("itemForOrder"{Use(Result(728))}, None())) , PathComponent("status"{Use(Result(744))}, None()) ){(Type(), Result(748))} , PathStart("Complete"{Use(Result(756))}, None()){(Type(), Result(760))} ){(Type(), Result(774))} , Equal(Path(This(){ Def( URI( Language("Booster2") , [ ID(NablNsThis(), This(), Unique("eclipse:///Booster2-examples/petstore.boo2/0")) , ID(NablNsClass(), "LineItem", Unique("eclipse:///Booster2-examples/petstore.boo2/0")) , ID(NablNsSystem(), "PetStore", Unique("eclipse:///Booster2-examples/petstore.boo2/0")) ] ) ) }, PathComponent("preparedBy"{Use(Result(782))}, None())), Null(){(Type(), Result(788))}){(Type(), Result(802))} ) at org.metaborg.spoofax.core.stratego.StrategoCommon.handleException(StrategoCommon.java:124) at org.metaborg.spoofax.core.stratego.StrategoCommon.handleException(StrategoCommon.java:136) at org.metaborg.spoofax.core.stratego.StrategoCommon.invoke(StrategoCommon.java:84) at org.metaborg.spoofax.core.transform.StrategoTransformer.transform(StrategoTransformer.java:134) ... 7 more Caused by: org.spoofax.interpreter.core.InterpreterErrorExit: Internal error: with clause failed unexpectedly in 'program' And(Equal(Path(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("itemForOrder"{Use(Result(728))},None)),PathComponent("status"{Use(Result(744))},None)){(Type,Result(748))},PathStart("Complete"{Use(Result(756))},None){(Type,Result(760))}){(Type,Result(774))},Equal(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("preparedBy"{Use(Result(782))},None)),Null{(Type,Result(788))}){(Type,Result(802))}) And(Equal(Path(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("itemForOrder"{Use(Result(728))},None)),PathComponent("status"{Use(Result(744))},None)){(Type,Result(748))},PathStart("Complete"{Use(Result(756))},None){(Type,Result(760))}){(Type,Result(774))},Equal(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("preparedBy"{Use(Result(782))},None)),Null{(Type,Result(788))}){(Type,Result(802))}) And(Equal(Path(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("itemForOrder"{Use(Result(728))},None)),PathComponent("status"{Use(Result(744))},None)){(Type,Result(748))},PathStart("Complete"{Use(Result(756))},None){(Type,Result(760))}){(Type,Result(774))},Equal(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("preparedBy"{Use(Result(782))},None)),Null{(Type,Result(788))}){(Type,Result(802))}) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:194) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:183) at org.strategoxt.lang.InteropSDefT$StrategyBody.evaluate(InteropSDefT.java:245) at org.strategoxt.lang.InteropSDefT$StrategyBody.eval(InteropSDefT.java:238) at org.spoofax.interpreter.stratego.Strategy.evaluate(Strategy.java:76) at org.spoofax.interpreter.core.Interpreter.evaluate(Interpreter.java:109) at org.spoofax.interpreter.core.Interpreter.invoke(Interpreter.java:82) at org.strategoxt.HybridInterpreter.invoke(HybridInterpreter.java:442) at org.metaborg.spoofax.core.stratego.StrategoCommon.invoke(StrategoCommon.java:78) ... 8 more Caused by: org.strategoxt.lang.StrategoErrorExit: Internal error: with clause failed unexpectedly in 'program' And(Equal(Path(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("itemForOrder"{Use(Result(728))},None)),PathComponent("status"{Use(Result(744))},None)){(Type,Result(748))},PathStart("Complete"{Use(Result(756))},None){(Type,Result(760))}){(Type,Result(774))},Equal(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("preparedBy"{Use(Result(782))},None)),Null{(Type,Result(788))}){(Type,Result(802))}) And(Equal(Path(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("itemForOrder"{Use(Result(728))},None)),PathComponent("status"{Use(Result(744))},None)){(Type,Result(748))},PathStart("Complete"{Use(Result(756))},None){(Type,Result(760))}){(Type,Result(774))},Equal(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("preparedBy"{Use(Result(782))},None)),Null{(Type,Result(788))}){(Type,Result(802))}) And(Equal(Path(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("itemForOrder"{Use(Result(728))},None)),PathComponent("status"{Use(Result(744))},None)){(Type,Result(748))},PathStart("Complete"{Use(Result(756))},None){(Type,Result(760))}){(Type,Result(774))},Equal(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("preparedBy"{Use(Result(782))},None)),Null{(Type,Result(788))}){(Type,Result(802))}) at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:60) at org.strategoxt.lang.DynamicStrategy.invoke(DynamicStrategy.java:22) at org.strategoxt.stratego_lib.try_1_0.invoke(try_1_0.java:28) at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:40) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:192) ... 16 more Caused by: org.spoofax.interpreter.core.InterpreterErrorExit: Internal error: with clause failed unexpectedly in 'program' And(Equal(Path(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("itemForOrder"{Use(Result(728))},None)),PathComponent("status"{Use(Result(744))},None)){(Type,Result(748))},PathStart("Complete"{Use(Result(756))},None){(Type,Result(760))}){(Type,Result(774))},Equal(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("preparedBy"{Use(Result(782))},None)),Null{(Type,Result(788))}){(Type,Result(802))}) And(Equal(Path(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("itemForOrder"{Use(Result(728))},None)),PathComponent("status"{Use(Result(744))},None)){(Type,Result(748))},PathStart("Complete"{Use(Result(756))},None){(Type,Result(760))}){(Type,Result(774))},Equal(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("preparedBy"{Use(Result(782))},None)),Null{(Type,Result(788))}){(Type,Result(802))}) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:194) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:183) at org.strategoxt.lang.InteropSDefT$StrategyBody.evaluate(InteropSDefT.java:245) at org.strategoxt.lang.InteropSDefT$StrategyBody.eval(InteropSDefT.java:238) at org.spoofax.interpreter.stratego.Strategy.evaluate(Strategy.java:76) at org.spoofax.interpreter.stratego.SDefT.evaluate(SDefT.java:213) at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:57) ... 20 more Caused by: org.strategoxt.lang.StrategoErrorExit: Internal error: with clause failed unexpectedly in 'program' And(Equal(Path(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("itemForOrder"{Use(Result(728))},None)),PathComponent("status"{Use(Result(744))},None)){(Type,Result(748))},PathStart("Complete"{Use(Result(756))},None){(Type,Result(760))}){(Type,Result(774))},Equal(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("preparedBy"{Use(Result(782))},None)),Null{(Type,Result(788))}){(Type,Result(802))}) And(Equal(Path(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("itemForOrder"{Use(Result(728))},None)),PathComponent("status"{Use(Result(744))},None)){(Type,Result(748))},PathStart("Complete"{Use(Result(756))},None){(Type,Result(760))}){(Type,Result(774))},Equal(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("preparedBy"{Use(Result(782))},None)),Null{(Type,Result(788))}){(Type,Result(802))}) at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:60) at org.strategoxt.lang.DynamicStrategy.invoke(DynamicStrategy.java:22) at org.strategoxt.stratego_lib.d_1175.invoke(d_1175.java:27) at org.strategoxt.lang.SRTS_some.map1MaintainAnnos(SRTS_some.java:58) at org.strategoxt.lang.SRTS_some.invoke(SRTS_some.java:21) at org.strategoxt.stratego_lib.d_1175.invoke(d_1175.java:33) at org.strategoxt.lang.SRTS_some.invoke(SRTS_some.java:29) at org.strategoxt.stratego_lib.d_1175.invoke(d_1175.java:33) at org.strategoxt.lang.SRTS_some.map1MaintainAnnos(SRTS_some.java:58) at org.strategoxt.lang.SRTS_some.map1MaintainAnnos(SRTS_some.java:61) at org.strategoxt.lang.SRTS_some.map1MaintainAnnos(SRTS_some.java:61) at org.strategoxt.lang.SRTS_some.invoke(SRTS_some.java:21) at org.strategoxt.stratego_lib.d_1175.invoke(d_1175.java:33) at org.strategoxt.lang.SRTS_some.invoke(SRTS_some.java:29) at org.strategoxt.stratego_lib.d_1175.invoke(d_1175.java:33) at org.strategoxt.lang.SRTS_some.mapTryIgnoreAnnos(SRTS_some.java:91) at org.strategoxt.lang.SRTS_some.map1MaintainAnnos(SRTS_some.java:80) at org.strategoxt.lang.SRTS_some.map1MaintainAnnos(SRTS_some.java:61) at org.strategoxt.lang.SRTS_some.map1MaintainAnnos(SRTS_some.java:61) at org.strategoxt.lang.SRTS_some.invoke(SRTS_some.java:21) at org.strategoxt.stratego_lib.d_1175.invoke(d_1175.java:33) at org.strategoxt.lang.SRTS_some.invoke(SRTS_some.java:29) at org.strategoxt.stratego_lib.d_1175.invoke(d_1175.java:33) at org.strategoxt.stratego_lib.sometd_1_0.invoke(sometd_1_0.java:25) at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:40) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:192) ... 26 more Caused by: org.spoofax.interpreter.core.InterpreterErrorExit: Internal error: with clause failed unexpectedly in 'program' And(Equal(Path(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("itemForOrder"{Use(Result(728))},None)),PathComponent("status"{Use(Result(744))},None)){(Type,Result(748))},PathStart("Complete"{Use(Result(756))},None){(Type,Result(760))}){(Type,Result(774))},Equal(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("preparedBy"{Use(Result(782))},None)),Null{(Type,Result(788))}){(Type,Result(802))}) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:194) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:183) at org.strategoxt.lang.InteropSDefT$StrategyBody.evaluate(InteropSDefT.java:245) at org.strategoxt.lang.InteropSDefT$StrategyBody.eval(InteropSDefT.java:238) at org.spoofax.interpreter.stratego.Strategy.evaluate(Strategy.java:76) at org.spoofax.interpreter.stratego.SDefT.evaluate(SDefT.java:213) at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:57) ... 51 more Caused by: org.strategoxt.lang.StrategoErrorExit: Internal error: with clause failed unexpectedly in 'program' And(Equal(Path(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("itemForOrder"{Use(Result(728))},None)),PathComponent("status"{Use(Result(744))},None)){(Type,Result(748))},PathStart("Complete"{Use(Result(756))},None){(Type,Result(760))}){(Type,Result(774))},Equal(Path(This{Def(URI(Language("Booster2"),[ID(NablNsThis,This,Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsClass,"LineItem",Unique("eclipse:///Booster2-examples/petstore.boo2/0")),ID(NablNsSystem,"PetStore",Unique("eclipse:///Booster2-examples/petstore.boo2/0"))]))},PathComponent("preparedBy"{Use(Result(782))},None)),Null{(Type,Result(788))}){(Type,Result(802))}) report_with_failure_0_1 program_0_0 program_0_0 program_0_0 sometd_1_0 try_1_0 t_4031 builder_ast_1_1 builder_1_1 heuristics_builder_0_0 at org.strategoxt.lang.SRTS_EXT_fatal_err_0_3.invoke(SRTS_EXT_fatal_err_0_3.java:28) at org.strategoxt.lang.compat.override.java_integration.SRTS_EXT_fatal_err_0_2.invoke(SRTS_EXT_fatal_err_0_2.java:33) at org.strategoxt.lang.compat.override.java_integration.report_failure_0_2_override.invoke(report_failure_0_2_override.java:27) at org.strategoxt.stratego_lib.report_with_failure_0_1.invoke(report_with_failure_0_1.java:32) at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:31) at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:192) ... 57 more
Issue Log
This is either a bug in the pretty-printer, or you’re feeding an incorrect term to the pretty printer. Make sure your term conforms to the signatures, otherwise the pretty-printer does not work.
Ah ok, thanks for the feedback. the terms should be valid as they are passed back to us when no strategy matches in one of our transforms. Has the behaviour of the pretty-printer changed when given term fragments?
If you pass partial fragments to the pretty-printer, make sure to use the
pp-<LanguageName>
strategy, orpp-<Sort>
whereSort
is the sort of the partial fragment. Otherwise, pretty-printing will fail.
Log in to post comments