When using a double quote in a string interpolation in a TS rule, I get a compilation error.

type rules
	Not(exp) : TypeRef("Bool", 0, [])
	where "xx" == "yy"
	 else error $[Type must be "Bool"!] on exp    // <-- Double quotes

This results in this (incorrect) Stratego code:

create-type-task(|ctx) :
Not(exp) -> <task-create-id(|ctx,[x1621])> x1621
where 
  eq28 := <type-match(|ctx, "yy")> "xx";
  <task-create-error-on-failure(|ctx, eq28, ["Type must be "Bool"!"])> exp;  // <-- Compiler error
  x1621 := <type-is(|ctx); task-create-id(|ctx, [eq28])> TypeRef("Bool", 0, [])

Note how the double quotes are not escaped. TS should not parse the string if double quotes must be escaped, or (preferably) TS should escape the double quotes when generating Stratego code.

A workaround is to put a backslash before each double quote: else error $[Type must be \"Bool\"!] on exp.

Submitted by D. Pelsmaeker on 17 September 2014 at 13:58

Log in to post comments