codetools: parse built-in function concat in constant, issue #33201

git-svn-id: trunk@57339 -
This commit is contained in:
mattias 2018-02-20 17:35:27 +00:00
parent 65d5df23da
commit 38166e7a0a
2 changed files with 17 additions and 3 deletions

View File

@ -1737,6 +1737,7 @@ function TPascalParserTool.ReadTilProcedureHeadEnd(
external;
external <id>;
external name <id> delayed;
external name concat('','');
external <id or number> name <id>;
external <id or number> index <id>;
[alias: <string constant>]
@ -2017,10 +2018,12 @@ begin
end;
if CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen] then
begin
// type cast or constant array
// type cast or constant array or built-in function
BracketType:=CurPos.Flag;
if not Extract then ReadNextAtom else ExtractNextAtom(true,Attr);
if not ReadConstant(ExceptionOnError,Extract,Attr) then exit;
repeat
if not Extract then ReadNextAtom else ExtractNextAtom(true,Attr);
if not ReadConstant(ExceptionOnError,Extract,Attr) then exit;
until CurPos.Flag<>cafComma;
if (BracketType=cafRoundBracketOpen)
and (CurPos.Flag<>cafRoundBracketClose) then
if ExceptionOnError then

View File

@ -47,6 +47,7 @@ type
procedure TestDeprecated;
procedure TestMissingGenericKeywordObjFPCFail;
procedure TestParseGenericsDelphi;
procedure TestParseExternalConcat;
end;
implementation
@ -433,6 +434,16 @@ begin
ParseModule;
end;
procedure TTestPascalParser.TestParseExternalConcat;
begin
Add([
'program test1;',
'{$mode objfpc}',
'procedure foo; cdecl; external name concat(''foo'', ''bar'');',
'begin']);
ParseModule;
end;
initialization
RegisterTest(TTestPascalParser);