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.


Jonas

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to