mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-10 07:29:32 +00:00
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:
parent
438942692a
commit
9c04b94093
15
Scanner.pas
15
Scanner.pas
|
@ -3654,7 +3654,8 @@ while digits > 0 do begin
|
||||||
digits := digits - 1;
|
digits := digits - 1;
|
||||||
end {while}
|
end {while}
|
||||||
else begin
|
else begin
|
||||||
Error(145);
|
if not skipping then
|
||||||
|
Error(145);
|
||||||
codePoint := $0000C0;
|
codePoint := $0000C0;
|
||||||
digits := 0;
|
digits := 0;
|
||||||
end; {else}
|
end; {else}
|
||||||
|
@ -4263,7 +4264,8 @@ var
|
||||||
NextCh;
|
NextCh;
|
||||||
end; {while}
|
end; {while}
|
||||||
if (val & $FF00) <> 0 then
|
if (val & $FF00) <> 0 then
|
||||||
Error(162);
|
if not skipping then
|
||||||
|
Error(162);
|
||||||
EscapeCh := val & $FF;
|
EscapeCh := val & $FF;
|
||||||
skipChar := false;
|
skipChar := false;
|
||||||
end;
|
end;
|
||||||
|
@ -4290,7 +4292,8 @@ var
|
||||||
end; {else}
|
end; {else}
|
||||||
val := (val << 4) | dig;
|
val := (val << 4) | dig;
|
||||||
if (val & $FF00) <> 0 then begin
|
if (val & $FF00) <> 0 then begin
|
||||||
Error(162);
|
if not skipping then
|
||||||
|
Error(162);
|
||||||
val := 0;
|
val := 0;
|
||||||
end; {if}
|
end; {if}
|
||||||
NextCh;
|
NextCh;
|
||||||
|
@ -4306,14 +4309,16 @@ var
|
||||||
EscapeCh := chFromUCN
|
EscapeCh := chFromUCN
|
||||||
else begin
|
else begin
|
||||||
EscapeCh := 0;
|
EscapeCh := 0;
|
||||||
Error(146);
|
if not skipping then
|
||||||
|
Error(146);
|
||||||
end; {else}
|
end; {else}
|
||||||
end;
|
end;
|
||||||
'''','"','?','\': EscapeCh := ord(ch);
|
'''','"','?','\': EscapeCh := ord(ch);
|
||||||
otherwise: Error(57);
|
otherwise: Error(57);
|
||||||
end {case}
|
end {case}
|
||||||
else begin
|
else begin
|
||||||
Error(162);
|
if not skipping then
|
||||||
|
Error(162);
|
||||||
EscapeCh := ord(ch);
|
EscapeCh := ord(ch);
|
||||||
end; {else}
|
end; {else}
|
||||||
end {if}
|
end {if}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user