From 38166e7a0aeec6585157ee0430d0e417f75777a8 Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 20 Feb 2018 17:35:27 +0000 Subject: [PATCH] codetools: parse built-in function concat in constant, issue #33201 git-svn-id: trunk@57339 - --- components/codetools/pascalparsertool.pas | 9 ++++++--- components/codetools/tests/testpascalparser.pas | 11 +++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index a0ed50b594..ffd73a1062 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -1737,6 +1737,7 @@ function TPascalParserTool.ReadTilProcedureHeadEnd( external; external ; external name delayed; + external name concat('',''); external name ; external index ; [alias: ] @@ -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 diff --git a/components/codetools/tests/testpascalparser.pas b/components/codetools/tests/testpascalparser.pas index 5340004fff..fa757cf24b 100644 --- a/components/codetools/tests/testpascalparser.pas +++ b/components/codetools/tests/testpascalparser.pas @@ -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);