Display Strings might get incorrect


Declaring e.g.
%token BEGINACTION "begin Action"
will result in strings that look like e.g.
Syntax error, unexpected "begin€tion", [...]
That’s because the code generated contains
    aliasses.Add(142, "\"begin\x20Action\"");
But the C# spec, Character literals, defines
hexadecimal-escape-sequence: \x hex-digit hex-digit(opt) hex-digit(opt) hex-digit(opt)
That means that the string added to aliasses does not contain an escaped space character \x20 followed by the characters "Ac", but an escaped Euro symbol \x20Ac.

This of course happens with other characters and other strings as well.


MartinMueller wrote Aug 4, 2014 at 12:05 PM

A solution, of course, is trivial: Always use 4 digits when escaping with "\x", e.g. "\x0020".

k_john_gough wrote Aug 15, 2014 at 4:34 AM

Hi Martin
Yes that does look like a problem. However, can you clarify which tool is producing the Syntax error diagnostic. I am unclear as to how such an alias string could be used in the context where CSC would expect an identifier.
I will, in any case, fix the escaped string syntax in the next refresh.

MartinMueller wrote Aug 15, 2014 at 7:35 AM

Hi John,
the only issue here is the escaping. The example I wrote, “Syntax error, unexpected "begin€tion", [...]” is an (expected) message from the code generated by gppg while parsing invalid input. That was how I noticed the issue.
Thank you!

MartinMueller wrote Apr 17, 2015 at 1:40 PM

The status of this is “Proposed”, but I think it is fixed with 1.5.2?