mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 06:06:17 +02:00
+ support for & and % in char constants, resolves #12186
git-svn-id: trunk@11809 -
This commit is contained in:
parent
6b0d250ea6
commit
69159eb9f3
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8556,6 +8556,7 @@ tests/webtbs/tw12050a.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw12050b.pp svneol=native#text/plain
|
tests/webtbs/tw12050b.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw12051.pp svneol=native#text/plain
|
tests/webtbs/tw12051.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1207.pp svneol=native#text/plain
|
tests/webtbs/tw1207.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw12186.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1222.pp svneol=native#text/plain
|
tests/webtbs/tw1222.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1223.pp svneol=native#text/plain
|
tests/webtbs/tw1223.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw1228.pp svneol=native#text/plain
|
tests/webtbs/tw1228.pp svneol=native#text/plain
|
||||||
|
@ -3649,25 +3649,47 @@ In case not, the value returned can be arbitrary.
|
|||||||
'#' :
|
'#' :
|
||||||
begin
|
begin
|
||||||
readchar; { read # }
|
readchar; { read # }
|
||||||
if c='$' then
|
case c of
|
||||||
begin
|
'$':
|
||||||
readchar; { read leading $ }
|
begin
|
||||||
asciinr:='$';
|
readchar; { read leading $ }
|
||||||
while (upcase(c) in ['A'..'F','0'..'9']) and (length(asciinr)<6) do
|
asciinr:='$';
|
||||||
begin
|
while (upcase(c) in ['A'..'F','0'..'9']) and (length(asciinr)<=5) do
|
||||||
asciinr:=asciinr+c;
|
begin
|
||||||
readchar;
|
asciinr:=asciinr+c;
|
||||||
end;
|
readchar;
|
||||||
end
|
end;
|
||||||
else
|
end;
|
||||||
begin
|
'&':
|
||||||
asciinr:='';
|
begin
|
||||||
while (c in ['0'..'9']) and (length(asciinr)<6) do
|
readchar; { read leading $ }
|
||||||
begin
|
asciinr:='&';
|
||||||
asciinr:=asciinr+c;
|
while (upcase(c) in ['0'..'7']) and (length(asciinr)<=7) do
|
||||||
readchar;
|
begin
|
||||||
end;
|
asciinr:=asciinr+c;
|
||||||
end;
|
readchar;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
'%':
|
||||||
|
begin
|
||||||
|
readchar; { read leading $ }
|
||||||
|
asciinr:='%';
|
||||||
|
while (upcase(c) in ['0','1']) and (length(asciinr)<=17) do
|
||||||
|
begin
|
||||||
|
asciinr:=asciinr+c;
|
||||||
|
readchar;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
asciinr:='';
|
||||||
|
while (c in ['0'..'9']) and (length(asciinr)<=5) do
|
||||||
|
begin
|
||||||
|
asciinr:=asciinr+c;
|
||||||
|
readchar;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
val(asciinr,m,code);
|
val(asciinr,m,code);
|
||||||
if (asciinr='') or (code<>0) then
|
if (asciinr='') or (code<>0) then
|
||||||
Message(scan_e_illegal_char_const)
|
Message(scan_e_illegal_char_const)
|
||||||
|
11
tests/webtbs/tw12186.pp
Normal file
11
tests/webtbs/tw12186.pp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{$mode objfpc}
|
||||||
|
begin
|
||||||
|
writeln(13); // ok
|
||||||
|
writeln($d); // ok
|
||||||
|
writeln(&15); // ok
|
||||||
|
writeln(%1101); // ok
|
||||||
|
writeln(0000098); // ok
|
||||||
|
writeln(#$62); // ok
|
||||||
|
writeln(#&142); // error!
|
||||||
|
writeln(#%1100010); // error!
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user