[fpc-devel] fpc modifiers
Martin
fpc at mfriebe.de
Fri Apr 29 11:54:27 CEST 2011
On 29/04/2011 09:25, Marco van de Voort wrote:
> In our previous episode, Joerg Schuelke said:
>>> No, since modifiers can be in any order, it could be a lot more than
>>> two tokens.
>>>
>> I think if the compiler reeds the<cdecl> token he needs a lookup of
>> only one token to decide: is used as a<modifier> or a
>> <identifier> token.
> No, since if the next token is "deprecated" he has the same devilish
> tradeoff.
Not that I am advertising to change it, but the next token wouldn't be
deprecated ever (that would be a syntax error (afaik), there has to be a
";" first).
Leaving out comment and compiler directives, the next token can be: ,;:=
// ";" not an idetifier
var a: procedure; cdecl;
// ,:= identifier
var a: procedure; cdecl, b: byte;
var a: procedure; cdecl: byte;
type: a=procedure; cdecl=byte;
// ' not an identifier
var a: integer; deprecated 'please do not use';
There are already 2 word tokens like
strict private
So cdecl and all the others could work as 2 "word" tokens too. cdecl
simply is a prefix to the next token, then if a "," or ":" is read, an
"cdecl" identifier is inserted and the ", or ":" handled; if a ";" is
read the cdecl is handled as part of the procedure before.
Martin
More information about the fpc-devel
mailing list