diff --git a/Source/uPSCompiler.pas b/Source/uPSCompiler.pas index f13307e2..42a8c908 100644 --- a/Source/uPSCompiler.pas +++ b/Source/uPSCompiler.pas @@ -4053,6 +4053,19 @@ function TPSPascalCompiler.ReadType(const Name: tbtString; FParser: TPSPascalPar Intf: TPSInterface; {$ENDIF} begin + { issue #246: accept Delphi's 'packed' before structured type declarations. + PascalScript records/arrays are always packed, so it only affects parsing } + if (FParser.CurrTokenID = CSTI_Identifier) and (FParser.GetToken = 'PACKED') then + begin + FParser.Next; + if not ((FParser.CurrTokenId = CSTII_Record) or (FParser.CurrTokenId = CSTII_Array) or + (FParser.CurrTokenId = CSTII_Set)) then + begin + MakeError('', ecIdentifierExpected, ''); + Result := nil; + Exit; + end; + end; if (FParser.CurrTokenID = CSTII_Function) or (FParser.CurrTokenID = CSTII_Procedure) then begin Result := ReadTypeAddProcedure(Name, FParser);