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


Index: keywordfunclists.pas
===================================================================
--- keywordfunclists.pas	(revision 27443)
+++ keywordfunclists.pas	(working copy)
@@ -916,6 +916,7 @@
     Add('CASE',{$ifdef f...@{$endif}allwaystrue);
     Add('CLASS',{$ifdef f...@{$endif}allwaystrue);
     Add('CONST',{$ifdef f...@{$endif}allwaystrue);
+    Add('CONSTREF',{$ifdef f...@{$endif}allwaystrue);
     Add('CONSTRUCTOR',{$ifdef f...@{$endif}allwaystrue);
     Add('DESTRUCTOR',{$ifdef f...@{$endif}allwaystrue);
     Add('DIV',{$ifdef f...@{$endif}allwaystrue);
@@ -988,6 +989,7 @@
     Add('CASE',{$ifdef f...@{$endif}allwaystrue);
     Add('CLASS',{$ifdef f...@{$endif}allwaystrue);
     Add('CONST',{$ifdef f...@{$endif}allwaystrue);
+    Add('CONSTREF',{$ifdef f...@{$endif}allwaystrue);
     Add('CONSTRUCTOR',{$ifdef f...@{$endif}allwaystrue);
     Add('DESTRUCTOR',{$ifdef f...@{$endif}allwaystrue);
     Add('DIV',{$ifdef f...@{$endif}allwaystrue);
Index: pascalparsertool.pas
===================================================================
--- pascalparsertool.pas	(revision 27443)
+++ pascalparsertool.pas	(working copy)
@@ -358,6 +358,7 @@
     Add('VAR',@KeyWordFuncVar);
     Add('THREADVAR',@KeyWordFuncVar);
     Add('CONST',@KeyWordFuncConst);
     Add('RESOURCESTRING',@KeyWordFuncResourceString);
     Add('EXPORTS',@KeyWordFuncExports);
     Add('LABEL',@KeyWordFuncLabel);
@@ -1299,7 +1300,7 @@
   procedure ReadPrefixModifier;
   begin
     // read parameter prefix modifier
-    if UpAtomIs('VAR') or UpAtomIs('CONST')
+    if UpAtomIs('VAR') or UpAtomIs('CONST') or UpAtomIs('CONSTREF')
     or (UpAtomIs('OUT') and (Scanner.CompilerMode in [cmOBJFPC,cmDELPHI,cmFPC]))
     then begin
       Desc:=ctnVarDefinition;
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to