Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-10

New constref parameter-type support in codetools

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Joost van der Sluis

Hi all,

There is a xpcom-branch which adds the 'constref' parameter type to Free Pascal. This can be useful for connecting to external api's (http://bugs.freepascal.org/view.php?id=7612)

Normally I would ask Mattias to add the 'constref' parsing to the codetools and in most cases it's done within a few hours. But this case I though: I can do this myself.

Attached patch works for me, but I doubt it is ok. Why are there two lists for keywords? (WordIsKeyword and WordIsDelphiKeyword) Is that for the different fpc-compilation mode's?

And what is AllKeyWords for? And why is 'END' added to it, it is already in WordIsKeyword?

Maybe if some explanation for all these keywords-lists is added, someone else can also have a look at them and fix/change somethings?

Joost

-------------- next part --------------
A non-text attachment was scrubbed...
Name: codetools_constref.diff
Type: text/x-patch
Size: 1754 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20101010/ee84774b/attachment.bin>

Reply by email

Mattias Gaertner
to Joost van der Sluis
Show quoted text 9 lines
Hi all, There is a xpcom-branch which adds the 'constref' parameter type to Free Pascal. This can be useful for connecting to external api's (http://bugs.freepascal.org/view.php?id=7612) Normally I would ask Mattias to add the 'constref' parsing to the codetools and in most cases it's done within a few hours. But this case I though: I can do this myself.

When is constref a keyword and when not?

Attached patch works for me, but I doubt it is ok. Why are there two lists for keywords? (WordIsKeyword and WordIsDelphiKeyword) Is that for the different fpc-compilation mode's?

Yes.
WordIsKeyword should probably better be named WordIsObjFPCKeyWord.

And what is AllKeyWords for?

It is used by the simple beautifier.

And why is 'END' added to it, it is already in WordIsKeyword?

Thanks for the hint. I removed it.

Maybe if some explanation for all these keywords-lists is added, someone else can also have a look at them and fix/change somethings?

Please create a feature request, so I don't forget it.

Mattias

Reply by email

Joost van der Sluis
to Mattias Gaertner
Mattias Gaertner wrote 14 lines
On Sun, 10 Oct 2010 15:53:43 +0200 Joost van der Sluis wrote: > Hi all, > > There is a xpcom-branch which adds the 'constref' parameter type to Free > Pascal. This can be useful for connecting to external api's > (http://bugs.freepascal.org/view.php?id=7612) > > Normally I would ask Mattias to add the 'constref' parsing to the > codetools and in most cases it's done within a few hours. But this case > I though: I can do this myself. When is constref a keyword and when not?

Only in the declaration of the parameters of a
function/procedure/method:

function/procedure test(constref param: integer);

No-where else.

Show quoted text 16 lines
> Attached patch works for me, but I doubt it is ok. Why are there two > lists for keywords? (WordIsKeyword and WordIsDelphiKeyword) Is that for > the different fpc-compilation mode's? Yes. WordIsKeyword should probably better be named WordIsObjFPCKeyWord. > And what is AllKeyWords for? It is used by the simple beautifier. > And why is 'END' added to it, it is already in WordIsKeyword? Thanks for the hint. I removed it.

And isn't it the case that all delphi-keywords are also ObjFpc-keywords? So the ObjFpc list can be defined as the delphi list + some extra keywords?

> Maybe if some explanation for all these keywords-lists is added, someone > else can also have a look at them and fix/change somethings? Please create a feature request, so I don't forget it.

I'll do.

Joost

Reply by email

Mattias Gaertner
to Joost van der Sluis
Show quoted text 22 lines
On Mon, 2010-10-11 at 01:46 +0200, Mattias Gaertner wrote: > On Sun, 10 Oct 2010 15:53:43 +0200 > Joost van der Sluis wrote: > > > Hi all, > > > > There is a xpcom-branch which adds the 'constref' parameter type to Free > > Pascal. This can be useful for connecting to external api's > > (http://bugs.freepascal.org/view.php?id=7612) > > > > Normally I would ask Mattias to add the 'constref' parsing to the > > codetools and in most cases it's done within a few hours. But this case > > I though: I can do this myself. > > When is constref a keyword and when not? Only in the declaration of the parameters of a function/procedure/method: function/procedure test(constref param: integer); No-where else.

Then it is not a global keyword.

Show quoted text 18 lines
> > Attached patch works for me, but I doubt it is ok. Why are there two > > lists for keywords? (WordIsKeyword and WordIsDelphiKeyword) Is that for > > the different fpc-compilation mode's? > > Yes. > WordIsKeyword should probably better be named WordIsObjFPCKeyWord. > > > > And what is AllKeyWords for? > > It is used by the simple beautifier. > > > > And why is 'END' added to it, it is already in WordIsKeyword? > > Thanks for the hint. I removed it. And isn't it the case that all delphi-keywords are also ObjFpc-keywords?

No. For example 'operator'.

Mattias

Reply by email