[fpc-pascal] deprecated syntax is inconsistent.

ik idokan at gmail.com
Thu Apr 29 14:35:28 CEST 2010


On Thu, Apr 29, 2010 at 13:39, Jonas Maebe <jonas.maebe at elis.ugent.be>wrote:

>
> On 29 Apr 2010, at 12:00, Graeme Geldenhuys wrote:
>
>  Michael Van Canneyt het geskryf:
>>
>>> Consider the following - what  you propose - statements:
>>>
>>>
>>> Var
>>>  A : Integer;
>>>  deprecated : Boolean;
>>>
>>> The compiler cannot decide whether the 'deprecated' is a modifier or the
>>>
>>
>> Yes it can, because in your example 'deprecated' is followed by a colon
>> and
>> a type.
>>
>> Var
>>   A : Integer; deprecated;
>>
>> This is *not* ambiguous at all,
>>
>
> It is ambiguous to the compiler, as is explained in one of the links I
> posted previously:
> http://wiki.freepascal.org/User_Changes_2.4.0#Order_of_field_and_method.2Fproperty_declarations
>
> "The above code was ambiguous to the compiler, because when it finished
> parsing the property, it could not decide based on seeing the default token
> whether this meant that the property was a default property, or whether a
> field coming after the property was called "default". It did find this out
> after it had parsed the default token (because the next token was a ":"
> rather than a ";"), but by then it was too late."
>
> The compiler uses only a single lookahead token, while disambiguating your
> example would require two.
>

I probably missing something here but how does the compiler knows about
override, cdecl etc... directives in one pass ?


>
>
> Jonas
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>

Ido
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20100429/ceabf511/attachment.html>


More information about the fpc-pascal mailing list