[fpc-pascal] deprecated syntax is inconsistent.

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Apr 29 12:39:41 CEST 2010

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.


More information about the fpc-pascal mailing list