Closed madkira closed 6 years ago
I checked, and the same happens for all string literals. E.g. if I make a property
property test : String = "\"Some string\""
It will generate this C-code:
t_var.Test_test_var = "\"Some string\"";
But in that case it actually makes sense, since we are adding the outer "" back.
So, maybe the actual fix would be to treat annotation values different from string literals? In a way, it isn't really a string literal...
Or, another thought: We could (should?) unescape the string literals when we parse it (since the backslashes are not really a part of the actual string we want), and escape it back when we generate the code.
This might be even more correct, if you consider languages that doesn't use "" to express string literals. You could choose to use single quotes in e.g. JavaScript...
I know it has been some back and forth changes in the way we by default escape quotes in annotations, extern expressions and maybe string literal. I guess we should indeed treat string literals different from annotations. @ffleurey what is now the (un)escaping strategy in:
The generator leaves backslashes \ on annotation
should generate
but the result is