Robert ask for reporting illegal Unicode character during compiling:
If I write
Код:
VAR
z : REAL;
BEGIN
z := %108.3;
the compiler complains (factor starts with incorrect symbol).
However, if I replace '%' with '‰' (Unicode 2030) there is no complaint; the 'per-thousand' sign is simply ignored. Surely there should be a complaint?
I found in the mailing list the solution from Chris:
It appears that (except when processing string constants) the compiler simply ignores any character that is not included in the 256-character LATIN-1 character set defined for the Component Pascal language. The relevant line of code is in DevCPM.Get:
Код:
PROCEDURE DevCPM.Get* (VAR ch: SHORTCHAR);
VAR ch1: CHAR;
BEGIN
REPEAT in.ReadChar(ch1); INC(curpos) UNTIL (ch1 < 100X) & (ch1 # TextModels.viewcode);
ch := SHORT(ch1)
END Get;
I haven't tested it but if you want to see compile-time errors then try modifying this function so that instead of ignoring the bad characters it substitutes a LATIN-1 character that is not part of the Component Pascal language. e.g. something like:
Код:
PROCEDURE DevCPM.Get* (VAR ch: SHORTCHAR);
VAR ch1: CHAR;
BEGIN
REPEAT in.ReadChar(ch1); INC(curpos) UNTIL (ch1 # TextModels.viewcode);
IF ch1 >= 100X THEN ch := "?" ELSE ch := SHORT(ch1) END
END Get;
A 16-bit Unicode character in your source code should then result in the same compilation error as the '%' character did in your example.
Further I found in
viewtopic.php?f=116&t=1837 the solution:
Код:
PROCEDURE DevCPM.Get* (VAR ch: SHORTCHAR);
VAR ch1: CHAR;
REPEAT in.ReadChar(ch1); INC(curpos) UNTIL ch1 # TextModels.viewcode;
ch := UniLang.Short(ch1);
END Get;
Where can I find the source of MODULE UniLang? What does it do?