On Sun, 13 Oct 2019, Ryan Joseph wrote:

To be clear:

here I meant that 'currently that will definitely not be done in fcl-passrc.'


This is a problem then because I wanted to make a language server for FPC
but if the parser doesn’t understand accepted FPC syntax the whole thing
falls apart.  Can you make an FPC complient mode or something then?  IMO
if the parser included with the compiler doesn’t understand the same
syntax as the compiler then we’re in trouble.

It should understand the same syntax, 100%. If it does not, that's definitely a bug.

The missing extension you can easily fix by explicitly adding it.

But of course I will add it to fcl-passrc, I simply was not aware of the
.inc. The documentation also must be adapted for this.

Here’s basically what I’m doing to parse. Nothing special and the engine is 
just a template that does just the minimum (like the examples in the package).

module := ParseSource(engine, ’bugs.pas', 'darwin', 'x86_64');

At first sight, you need to do at least

module := ParseSource(engine, ’-Mdelphi bugs.pas', 'darwin', 'x86_64');

Because for the language constructs you are using you need mode delphi.
(unless you have the necessary $mode and $modeswitch statements in code)

The parser by default does not enable mode delphi or objfpc for that matter, so you need to specify that on the 'command-line'.

- This is a new version from 3 days ago.
- The record sections failed because they are inside a function. If I pull the 
record out of the function they work.

Ahah...

That needs to be tested then. This seems to be a bug. Can you please create
a bug with a compilable example ?

- Please test the operator because I don’t think the parser understands it.

OK, that's strange, because I can see the code for handling operators, and
operators are definitely parsed, the RTL/FCL are riddled with operators...

Then this needs to be tested and possibly fixed too. Please report this also as a bug with a testcase, so I don't forget.

I'll try to fix them ASAP.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to