[fpc-pascal] More syntax questions (part 3)

Adriaan van Os adriaan at adriaan.biz
Sun Dec 17 20:52:54 CET 2023


Michael Van Canneyt wrote:

>> 32. Are the set operators "include", "exclude" missing in the syntax 
>> diagrams ? Is "><" missing (specifically) as set operator in the 
>> syntax diagrams ?
> 
> Include/Exclude are not operators. They are procedure calls.

Section 12.8.5 says "Elements can be added or removed from the set with the
Include or Exclude operators" and table 12.6 lists them as "Set operators". So, that is confusing 
(to me).

> 
>>
>> 22. Various rules refer to a rule <variable-reference> for which I can't find the rule. What is it ?
> 
> identifier.

Can't a variable also be qualified ? Therefore ?

	variable-reference = qualified-identifier .

>> 41. Is it correct that <operator-definition> is referenced only in the record <component-list> rule ? I would expect something like an <operator-declaration-part> in various declaration rules.
> 
> To the best of my knowledge, only records support operator definitions.
> 
> The 'operator' chapter handles 'global' operators which are at the level of
> global functions/procedures.

Your reply puzzles me. I mean code like this

{$mode fpc}
unit Operators;

interface

   const
     ki : complex = ( re: 0.0; im: 1.0);

   operator + ( z1: complex; z2: complex) sum: complex;
   operator + ( d1: double;  z2: complex) sum: complex;
   operator + ( z1: complex; d2: double ) sum: complex;

etcetera

But to parse that, the rules for <interface-part> and <declaration-part> need something like an 
<operator-declaration-part>, don't they ?

Regards,

Adriaan van Os



More information about the fpc-pascal mailing list