mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 13:29:27 +02:00
+ patch by Seth Grover to support line number macro returning a numerical number, resolves #21372
git-svn-id: trunk@20608 -
This commit is contained in:
parent
0f9b8c8936
commit
99b0421193
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -12280,6 +12280,7 @@ tests/webtbs/tw2129b.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2131.pp svneol=native#text/plain
|
||||
tests/webtbs/tw21443.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2145.pp svneol=native#text/plain
|
||||
tests/webtbs/tw21472.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2158.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2159.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2163.pp svneol=native#text/plain
|
||||
|
@ -1743,6 +1743,7 @@ In case not, the value returned can be arbitrary.
|
||||
args : string;
|
||||
hp : tinputfile;
|
||||
found : boolean;
|
||||
macroIsString : boolean;
|
||||
begin
|
||||
current_scanner.skipspace;
|
||||
args:=current_scanner.readcomment;
|
||||
@ -1760,6 +1761,7 @@ In case not, the value returned can be arbitrary.
|
||||
{ save old }
|
||||
path:=hs;
|
||||
{ first check for internal macros }
|
||||
macroIsString:=true;
|
||||
if hs='TIME' then
|
||||
hs:=gettimestr
|
||||
else
|
||||
@ -1771,6 +1773,12 @@ In case not, the value returned can be arbitrary.
|
||||
else
|
||||
if hs='LINE' then
|
||||
hs:=tostr(current_filepos.line)
|
||||
else
|
||||
if hs='LINENUM' then
|
||||
begin
|
||||
hs:=tostr(current_filepos.line);
|
||||
macroIsString:=false;
|
||||
end
|
||||
else
|
||||
if hs='FPCVERSION' then
|
||||
hs:=version_string
|
||||
@ -1791,9 +1799,10 @@ In case not, the value returned can be arbitrary.
|
||||
if hs='' then
|
||||
Message1(scan_w_include_env_not_found,path);
|
||||
{ make it a stringconst }
|
||||
hs:=''''+hs+'''';
|
||||
if macroIsString then
|
||||
hs:=''''+hs+'''';
|
||||
current_scanner.insertmacro(path,@hs[1],length(hs),
|
||||
current_scanner.line_no,current_scanner.inputfile.ref_index);
|
||||
current_scanner.line_no,current_scanner.inputfile.ref_index);
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
7
tests/webtbs/tw21472.pp
Normal file
7
tests/webtbs/tw21472.pp
Normal file
@ -0,0 +1,7 @@
|
||||
var
|
||||
s : string;
|
||||
i : integer;
|
||||
begin
|
||||
s := {$I %LINE%};
|
||||
i := {$I %LINENUM%}
|
||||
end.
|
Loading…
Reference in New Issue
Block a user