On 16.11.2017 15:10, Mattias Gaertner wrote:
> On Thu, 16 Nov 2017 14:12:18 +0100
> Sven Barth via fpc-pascal <
[hidden email]> wrote:
>
>> [...]
>> So, how will FPC distinguish the two []?
>>
>>
>> The only idea I have is to check whether the first identifier is a
>> attribute and if not handle it as a modifier (or if a comma is following
>> the first identifier).
>
> pparser can't do that.
>
> And I fear that this heuristic will lead to confusing error messages. I
> hope there is a better way.
>
> Delphi does not support it. It thinks it is an undefined attribute. So
> IMO FPC's [] modifier should be disabled in mode delphi+delphiunicode.
> So the problem will only happen in mode objfpc or when the user
> enable the modeswitch prefixedattributes.
>
> Maybe pparser can use a heuristic. What is the syntax and keywords of
> fpc's [] modifier?
Keywords are all supported modifiers.
"[" <MODIFIER> [,<MODIFIER>[,...]] "]"
And this can be mixed and matched with non-bracketed modifiers, so the
following is valid:
=== code begin ===
procedure Bla; cdecl; [public, overload]; iocheck;
begin
end;
=== code end ===
>
> If it is correct that FPC's modifier was never documented and is
> hardly used, perhaps a $modeswitch procmodifierbrackets can be
> added?
It is at least not totally undocumented:
https://www.freepascal.org/docs-html/current/ref/refsu81.html#x199-22100014.10.12It's a feature that FPC supports and thus there are probably users out
there that use it no matter whether it's in Delphi mode or not.
Regards,
Sven
_______________________________________________
fpc-pascal maillist -
[hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal