The code generator in Viatra 2.8.0 resolves escaped characters in string constants which results in compile errors when trying to compile the generated code.
Example vql source:
example_1 == "something in \"quotation marks\"";
example_2 == "something with backslash \\";
The resulting generated code will look like the following:
// example_1 == "something in \"quotation marks\"";
PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
new ConstantValue(body, var__virtual_1_, "something in "quotation marks"");
// example_2 == "something with backslash \\";
PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
new ConstantValue(body, var__virtual_1_, "something with backslash \");
The escaped characters are resolved and substituted, which causes compile errors.
The workaround I found is to place such strings inside an eval block. The resulting code will compile without issues this way.
example_1 == eval("something in \"quotation marks\"");
example_2 == eval("something with backslash \\");
Might be caused by the same escaping issue as #120 (but I don't consider either of them as a duplicate as they are different issues with likely the same cause.
The code generator in Viatra 2.8.0 resolves escaped characters in string constants which results in compile errors when trying to compile the generated code.
Example vql source:
The resulting generated code will look like the following:
The escaped characters are resolved and substituted, which causes compile errors.
The workaround I found is to place such strings inside an eval block. The resulting code will compile without issues this way.