fcl-passrc: parser: clean up

git-svn-id: trunk@36126 -
This commit is contained in:
Mattias Gaertner 2017-05-05 17:47:48 +00:00
parent a60f3b26e6
commit 76734070c4

View File

@ -1184,7 +1184,7 @@ begin
K:=stkAlias K:=stkAlias
else if (CurToken=tkSquaredBraceOpen) then else if (CurToken=tkSquaredBraceOpen) then
begin begin
if LowerCase(Name)='string' then // Type A = String[12]; if LowerCase(Name)='string' then // Type A = String[12]; shortstring
K:=stkString K:=stkString
else else
ParseExcSyntaxError; ParseExcSyntaxError;
@ -3798,18 +3798,17 @@ procedure TPasParser.ParseProcedureOrFunctionHeader(Parent: TPasElement;
CT : TPasClassType; CT : TPasClassType;
begin begin
// ToDo: add an event for the resolver to use a faster lookup
I:=ASection.Functions.Count-1; I:=ASection.Functions.Count-1;
While (I>=0) and (CompareText(TPasElement(ASection.Functions[I]).Name,AName)<>0) do While (I>=0) and (CompareText(TPasElement(ASection.Functions[I]).Name,AName)<>0) do
Dec(I); Dec(I);
Result:=I<>-1; Result:=I<>-1;
I:=Pos('.',AName); I:=Pos('.',AName);
if (Not Result) and (I<>0) then if (Not Result) and (I>0) then
begin begin
CN:=Copy(AName,1,I-1); CN:=Copy(AName,1,I-1);
FN:=Aname; FN:=AName;
Delete(FN,1,I); Delete(FN,1,I);
I:=Asection.Classes.Count-1; I:=ASection.Classes.Count-1;
While Not Result and (I>=0) do While Not Result and (I>=0) do
begin begin
CT:=TPasClassType(ASection.Classes[i]); CT:=TPasClassType(ASection.Classes[i]);
@ -3819,6 +3818,7 @@ procedure TPasParser.ParseProcedureOrFunctionHeader(Parent: TPasElement;
end; end;
end; end;
end; end;
procedure ConsumeSemi; procedure ConsumeSemi;
begin begin
NextToken; NextToken;
@ -3826,7 +3826,6 @@ procedure TPasParser.ParseProcedureOrFunctionHeader(Parent: TPasElement;
UngetToken; UngetToken;
end; end;
Var Var
Tok : String; Tok : String;
CC : TCallingConvention; CC : TCallingConvention;
@ -3852,7 +3851,8 @@ begin
ResultEl:=TPasFunctionType(Element).ResultEl; ResultEl:=TPasFunctionType(Element).ResultEl;
ResultEl.ResultType := ParseType(ResultEl,Scanner.CurSourcePos); ResultEl.ResultType := ParseType(ResultEl,Scanner.CurSourcePos);
end end
// In Delphi mode, the implementation in the implementation section can be without result as it was declared // In Delphi mode, the implementation in the implementation section can be
// without result as it was declared
// We actually check if the function exists in the interface section. // We actually check if the function exists in the interface section.
else if (msDelphi in CurrentModeswitches) and else if (msDelphi in CurrentModeswitches) and
(Assigned(CurModule.ImplementationSection) or (Assigned(CurModule.ImplementationSection) or