How to use '[' and ']' in formatted strings?
During code generation it might become necessary to createAsked by Sven Stork on 15 January 2013 at 23:02
']'and characters in the output file. Unfortunately those characters are part of the the Stratego grammar.
To generate those characters inside a formatted string (i.e.,Answered by Sven Stork on 15 January 2013 at 23:04
$[...]) you first have to enclose them in double quotes and the enclose them in
']'to escape into the variable area. (e.g.,
Subscript(e, index) -> $[ ([e']) ["["] [index'] ["]"] ])
You can also use theAnswered by Gabriël Konat on 16 January 2013 at 12:19
$<...>string formatters if you want to easily use
Yet another way is to use escaping like this:Answered by Lennart Kats on 16 January 2013 at 17:18
$[ ...... $]$ ...... ]