Thanks a lot for providing the code!
Unfortunately the problem is much bigger than the constref keyword itself.
I have already implemented it for DelphiAST in the way you did. See
this pull request.
When I opened the pull request I already knew it would be a nasty way to include the constref keyword that way, so we started a discussion. Now I'm happy with the project owner's decision
not to merge it.
When a Delphi user creates something like this:
procedure AddReference(ConstRef: Pointer)
DelphiAST would throw an error on valid Delphi code. The project itself has no support for switching dialects on runtime. Before applying FPC related keywords we have to change DelphiAST to become more flexible.
Btw. the constref keyword is not the only thing DelphiAST has problems when parsing Free Pascal code. That's why even my own fork has currently no support for constref.
Before refactoring DelphiAST on my own I want to focus on making OmniPascal more stable for Delphi users. As long as FPC users work with {$MODE Delphi} they can already use OmniPascal beside some restrictions regarding basic libraries.
Don't get me wrong: I really want to support FPC in the future!
P.S: Did you get OmniPascal run with the instructions from my last post?