Allow invalid escape sequences and UCN-like sequences in skipped code.

The standard wording is not always clear on these cases, but I think at least some of them should be allowed and others may be undefined behavior (which we can choose to allow). At any rate, this allows non-standard escape sequences targeted at other compilers to appear in skipped-over code.

There probably ought to be similar handling for #defines that are never expanded, but that would require more code changes.
This commit is contained in:
Stephen Heumann 2021-09-06 20:37:17 -05:00
parent 438942692a
commit 9c04b94093

View File

@ -3654,6 +3654,7 @@ while digits > 0 do begin
digits := digits - 1;
end {while}
else begin
if not skipping then
Error(145);
codePoint := $0000C0;
digits := 0;
@ -4263,6 +4264,7 @@ var
NextCh;
end; {while}
if (val & $FF00) <> 0 then
if not skipping then
Error(162);
EscapeCh := val & $FF;
skipChar := false;
@ -4290,6 +4292,7 @@ var
end; {else}
val := (val << 4) | dig;
if (val & $FF00) <> 0 then begin
if not skipping then
Error(162);
val := 0;
end; {if}
@ -4306,6 +4309,7 @@ var
EscapeCh := chFromUCN
else begin
EscapeCh := 0;
if not skipping then
Error(146);
end; {else}
end;
@ -4313,6 +4317,7 @@ var
otherwise: Error(57);
end {case}
else begin
if not skipping then
Error(162);
EscapeCh := ord(ch);
end; {else}